2
I am trying to install iStats via a ruby gem.
First I ran the command:
xcode-select --install
and the output was:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
. So that was okay.
Then I ran:
sudo gem install iStats
and the output was:
Building native extensions. This could take a while...
ERROR: Error installing iStats:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/iStats-1.6.1/ext/osx_stats
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190117-44665-taivle.rb extconf.rb
creating Makefile
current directory: /Library/Ruby/Gems/2.3.0/gems/iStats-1.6.1/ext/osx_stats
make "DESTDIR=" clean
current directory: /Library/Ruby/Gems/2.3.0/gems/iStats-1.6.1/ext/osx_stats
make "DESTDIR="
make: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin16/ruby/config.h', needed by `smc.o'. Stop.
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/iStats-1.6.1 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-16/2.3.0/iStats-1.6.1/gem_make.out
I'm not sure what all of this means, but I know it did not work. So I tried installing ruby using:
brew install ruby
, which seemed to do its job.
Then I tried the sudo gem
command again but I got the same output as above.
What is going wrong here?
EDIT:
I just read https://stackoverflow.com/a/26600110/6678549 and tried this:
sudo gem update --system
and got this output:
Updating rubygems-update
Successfully installed rubygems-update-3.0.2
Parsing documentation for rubygems-update-3.0.2
Installing darkfish documentation for rubygems-update-3.0.2
Done installing documentation for rubygems-update after 108 seconds
Parsing documentation for rubygems-update-3.0.2
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.0.2
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem
So it almost worked, but I'm still no closer to installing iStats.
EDIT 2:
My ruby version is ruby 2.3.7p456
in case it is relevant and I am using MacOS Sierra. I have done a bit of reading and found about System Integrity Protection. I have tried a few other commands like sudo gem install iStats -n /usr/local/bin, but still nothing works. Although after running
sudo gem update --system` it now says the latest version is already installed.
1
Note that I recommend against messing with the system Ruby and instead installing
– slhck – 2019-01-17T15:52:26.983rbenv
: https://github.com/rbenv/rbenv – this should make your life easier, and you don't need to runsudo
for anything.@slhck Thanks for the advice, I'll keep that in mind in the future. – AkThao – 2019-01-17T18:56:10.570