Chris911 / iStats

Ruby gem for your mac stats
http://chris911.github.io/iStats/
MIT License
2.4k stars 169 forks source link

Same problem with iStats #100

Open shivahoj opened 3 years ago

shivahoj commented 3 years ago

Hello, OSX catalina 10.15.7 on an unsupported Macbook 2011 (via dosdude's catalinaPatcher) here. I know nothing about ruby, so bear with me.

> $ which ruby
/usr/bin/ruby
~                                                                                                                                                              [17:45:51]
> $ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

> $ sudo gem install iStats
Password:
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.6.0/gems/iStats-1.6.1/ext/osx_stats
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20201116-4433-ufypgo.rb extconf.rb
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/iStats-1.6.1/ext/osx_stats
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.6.0/gems/iStats-1.6.1/ext/osx_stats
make "DESTDIR="
make: *** No rule to make target `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h', needed by `smc.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/iStats-1.6.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/iStats-1.6.1/gem_make.out

What should I do?

Nakilon commented 3 years ago

Don't use sudo on macOS. Either use these env variables to instruct the gem command to install somewhere in your user directory: https://stackoverflow.com/a/27677094/322020 Or better install Homebrew and do brew install rbenv and read docs abut using rbenv that will then install gems somehere in ~/.rbenv.

Sugar-Coder commented 3 years ago

Same problem on Big Sur. I use the gem install iStats and get the same output like above. But I have added the export PATH="$HOME/.gem/ruby/2.6.0/bin:$PATH" export GEM_HOME=$HOME/.gem to my .bash_profile.

ghost commented 3 years ago

Hello, OSX catalina 10.15.7 on an unsupported Macbook 2011 (via dosdude's catalinaPatcher) here. I know nothing about ruby, so bear with me.

> $ which ruby
/usr/bin/ruby
~                                                                                                                                                              [17:45:51]
> $ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

> $ sudo gem install iStats
Password:
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.6.0/gems/iStats-1.6.1/ext/osx_stats
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20201116-4433-ufypgo.rb extconf.rb
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/iStats-1.6.1/ext/osx_stats
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.6.0/gems/iStats-1.6.1/ext/osx_stats
make "DESTDIR="
make: *** No rule to make target `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h', needed by `smc.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/iStats-1.6.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/iStats-1.6.1/gem_make.out

What should I do?

Same problem on Big Sur. I use the gem install iStats and get the same output like above. But I have added the export PATH="$HOME/.gem/ruby/2.6.0/bin:$PATH" export GEM_HOME=$HOME/.gem to my .bash_profile.

You can do these to make it work:

First, don't use the gem that Mac provides you, if you use this one, You need 'sudo', and get error.

brew install ruby

Run it to install a gem.

Then add this ruby path and this gem path to your .zshrc files, in my Mac is like this

export PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH="/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"

It may be different in your Mac ! And The istats will install in /usr/local/lib/ruby/gems/(your gem version)/gems/

Finally, run

source ~/.zshrc
gem install iStats
istats

You can find it works well. image image

ChiehJang commented 3 years ago

https://notes.zhangjie.work/index.php/archives/35/