Command "istats" gives "-bash: istats: command not found" after "gem install iStats" I wanted to use iStats in command line/terminal mode, so I did the following:


I installed iStats with the command gem install iStats as per this answer to an AskDifferent question;
However, when I issue the command istats I get a -bash: istats: command not found;
Issuing the command gem list shows me that iStats is installed (*** LOCAL GEMS *** and in second position it reads iStats (1.6.1);
I checked and the app resides in /usr/local/lib/ruby/gems/2.6.0/gems/;
Issuing a gem environment command shows the following - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0;
I uninstalled the Gem by issuing gem uninstall iStats;
Then issuing gem list shows that the app was indeed removed;
Then I issued gem install iStats that gave the following output:

Fetching iStats-1.6.1.gem
Building native extensions. This could take a while...
Successfully installed iStats-1.6.1
Parsing documentation for iStats-1.6.1
Installing ri documentation for iStats-1.6.1
Done installing documentation for iStats after 0 seconds
1 gem installed

Issuing istats command gives again -bash: istats: command not found.


Any ideas?



System used (just in case):


macOS Mojave Version 10.14.5
Ruby version: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports)
Processor: 2.7 GHz Intel Core i7
Memory: 16 GB 2133 MHz LPDDR3
Graphics: Intel Iris Plus Graphics 655 1536 MB
Thanks to historystamp's comment here is how the problem was solved (for bash shell):

Open/Launch Terminal
gem uninstall iStats (source)
gem install iStats --user-install (source)
export PATH=&quot;~/.gem/ruby/2.6.0/bin:$PATH&quot; (source)
source ~/.bash_profile (source)
istats

If you use macOS Catalina, the default shell is zsh. The adapted instructions are the following:

Open/Launch Terminal
gem uninstall iStats (source)
gem install iStats --user-install (source)
Open or create ~/.zshrc
At the end of the file (or where appropriate) insert: export PATH=~/.gem/ruby/2.6.0/bin:$PATH (source)
Save file ~/.zshrc
Source the .zshrc file: . ~/.zshrc (source)
istats