Try the following:
sudo apt-get install rubygems
Answer from Thomas on Stack OverflowInstallation probelm: zsh: command not found: jekyll - Jekyll Talk
Cannot run gem executables
I did confirm that the rubocop executable is in /usr/local/lib/ruby/gems/2.7.0/bin. Do I need to add this directory to $PATH?
Yes, the bin directory needs to be in your path. A little trick I use to keep the current version's directory in the PATH is something like this in .bashrc (or .zshrc whatever it is for you)
export PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"More on reddit.com
zsh: command not found: colorls
rubygems - Why does ZSH return "Command not found" error for my RVM gems? - Stack Overflow
I had the same issue using zsh and this fixed it:
Copy$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
$ echo 'eval "$(rbenv init -)"' >> ~/.zshenv
$ echo 'source $HOME/.zshenv' >> ~/.zshrc
$ exec $SHELL
You seem to be after installing bundler system-wide. To do this, you need to pass --no-user-install flag to gem and execute it with sudo:
Copysudo gem install bundler --no-user-install
After this, you should see bundle in /usr/bin/ just fine:
Copy$ ls /usr/bin/bundle
/usr/bin/bundle*
I installed Ruby via Homebrew so I didn't f-up my system Ruby. I then started a project and installed some executable gems (Jekyll and rubocop). However, when I try to run either command, I receive the error zsh: command not found.
Here is my gem env output:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-darwin19]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /Users/onetwobus/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.7.0/bin
- SPEC CACHE DIRECTORY: /Users/onetwobus/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.7.1_2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-19
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.7.0
- /Users/onetwobus/.gem/ruby/2.7.0
- /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/gems/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbinI did confirm that the rubocop executable is in /usr/local/lib/ruby/gems/2.7.0/bin. Do I need to add this directory to $PATH?
check your rc files
- .zshenv
- .zshrc
- .zlogin
- .zprofile
most likely in one of those PATH is reset after RVM was sourced
also some oh-my-zsh plugins can break stuff, try disabling them and enabling one by one.
In my case, this was related to ZSH complains about RVM __rvm_cleanse_variables: function definition file not found , and following the instructions there solved it.
Your $PATH variable needs to include the exact path to your Ruby's bin directory. Adding a directory to the PATH does not include it's subfolders. Try adding the bin directory via:
export PATH=$PATH:/home/adam/.gem/ruby/1.8/bin
or if you installed the gem using sudo:
export PATH=$PATH:/usr/lib/ruby/gems/1.8/bin
You might want to add this to your .bashrc file, so that you don't have to set this manually every time your open up a new bash.
(Just stealing @John Franklin's comment)
$ gem environment
Will tell you the EXECUTABLE DIRECTORY. Then put whatever that value is in your PATH like so (in your .bashrc or other shell config file).
export PATH="$PATH:/path/to/bin"
Reload your shell and you should then be able to use the installed gem.
It seems that either the rackup executable that is in your $PATH when you open a new terminal is not the same one that's in your path when you run your boot script, or else there are other aspects of the environment that are different in the two different scenarios.
You can test this by adding echo $PATH and env at the top of script and examining what is printed for each scenario.
If using the wrong $PATH is the issue, one quick and easy solution would be to call rackup using the full path instead, like so :
# replace /path/to with actual path
cd /Users/me/Sites/Ruby/mysite && /path/to/rackup &
enter image description hereenter image description here i need you to take a pic with a midget holding these balloons - Puffy combs