Getting my local environment setup for Ruby on Rails.
So I have rails installed in my .rbenv file, and when I type which rails, that's confirmed.
where rails shows the /Users/<username>/.rbenv/shims folder where rails is multiple times, like 15 times currently, then one single entry for usr/bin/rails.
However, if you run rails --version, you get this:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
If you run gem install rails, you get this:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
But if you go back and run where rails again, you'll get even more entries for the /Users/<username>/.rbenv/shims directory, indicating that it's incrementing each time.
Tried to add an env variable my ~/.zshrc as per some guidance online, as so: export GEM_HOME="$HOME/.gem"
When I save and source it, I get a different error:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /Users/<username>/.gem/gems/racc-1.7.3/ext/racc/cparse
/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 ./siteconf20240118-44186-1bplyzo.rb extconf.rb
creating Makefile
current directory: /Users/<username>/.gem/gems/racc-1.7.3/ext/racc/cparse
make "DESTDIR=" clean
current directory: /Users/<username>/.gem/gems/racc-1.7.3/ext/racc/cparse
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-darwin22/ruby/config.h', needed by `cparse.o'. Stop.
make failed, exit code 2
Gem files will remain installed in /Users/<username>/.gem/gems/racc-1.7.3 for inspection.
Results logged to /Users/addie/.gem/extensions/universal-darwin-22/2.6.0/racc-1.7.3/gem_make.out
Anyone have any idea how to resolve this?