Rails and all my gem files + homebrew installs have been working fine up until this point.
I ran
homebrew install postgresql
and was following the prompts pretty much as indicated in this video but it kept giving me error messages saying there is a server already running. I checked
which psql
in the terminal and it reported a
usr/bin
location rather than
usr/local/bin
indicating I was using the postgres that comes with osx not the new homebrew install.
When I attempted to start the database server I recieved an error message saying the server is already running. There is a mention of this error message in the postgres help documentation but no real working solution.
Attempting brew doctor confirmed that i needed to change my PATH in .bash_profile.
I came across this little snippet here on stack overflow for the .bash_profile edit.
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin
I saved the file and managed to get postgres up and running fine but then when I went to start a new rails app.
rails new blog -d postgresql
it says
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.
Any attempt to install does not work until i change the bash_profile file back to what it was before.
If I change it back postgres has the same issue again saying there is already a server running.
Also I thought it might be a launch agent or something but I don't think there are any that are set up.
I figure either something is installed in the wrong place or I have to add something to the .bash_profile?
Don't set your $PATH explicitly. You should append or prepend to it instead:
# In your .bash_profile
export PATH="/usr/local/bin:$PATH"
My guess is that you either use RVM or rbenv. If you change your path to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin explicitly then RVM or rbenv won't be in your path.
Related
Homebrew is already installed.
xCode is already installed too.
in use the codecademy youtube tutorial but it doesn't work :(
youtube.com/watch?v=3Lp5XP8pWkU&t=198s
i have installed rvm and i guess this will working but when i want to install ruby it looks that it works but then wenn i type $ ruby -v
i see only this message -bash: /Applications/MAMP/Library/bin/ruby: No such file or directory. i have deleted MAMP from my Mac, but this should also work without Mamp. Or am i wrong i need your help. This message is shown although when i type rails -v or rails new testApp. I cant make a new ruby on rails app. i need your help. Please take a look on the images.
Terminal Code rvm Ruby
Terminal Code error message
It seems that either your MAMP installation is broken, or MAMP itself is broken.
Can you reinstall MAMP, To "uninstall" MAMP, you only have to delete the MAMP directory and everything returns to the original state (MAMP does not alter anything on the "normal" OS X).
and then try to install ruby
$ rvm install 1.9.3
Also check your /.profile file that it has all the following entries
alias erb='/Applications/MAMP/Library/bin/erb'
alias gem='/Applications/MAMP/Library/bin/gem'
alias irb='/Applications/MAMP/Library/bin/irb'
alias rake='/Applications/MAMP/Library/bin/rake'
alias rdoc='/Applications/MAMP/Library/bin/rdoc'
alias ri='/Applications/MAMP/Library/bin/ri'
alias ruby='/Applications/MAMP/Library/bin/ruby'
alias rails='/Applications/MAMP/Library/bin/rails'
you can also use rbenv if rvm is not working for you, here is the tutorial which explains How to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv
https://gist.github.com/jakebellacera/3429066
When I create a scaffold in terminal, I get the above error message. I have type the following command first:
echo "source \$HOME/.rvm/scripts/rvm" >> ~/.bashrc
I still get the following error:
WARNING:root:could not open file '/etc/apt/sources.list.d/passenger.list'
The program 'rails' is currently not installed. You can install it by typing:
sudo apt install ruby-railties
Any help will be greatly appreciated.
Try running the command source ~/.bashrc and then re-running rails. If that doesn't work, a different approach may be needed.
The problem is that as far as your OS is concerned, Rails doesn't exist. There could be multiple reasons for this. Seeing that you're using rvm, rvm is supposed to tell Ubuntu where to find rails.
Make sure that you are using the correct version of ruby specified in your Gemfile by typing rvm current. Make sure you are using the correct version when running bundle install, otherwise the gems will be installed under a different ruby version.
Also, make sure that the ~/.rvm directory exists and that the path specified in your .bashrc file is correct.
Let me know if any of these suggestions help.
I've been following the amazingly convoluted path to installing Ruby (and Rails) on a Mac (OSX Yosemite). I used the Terminal to install rbenv. Then I tried to install Rails, following the instructions # http://rubyonrails.org/download/
Terminal displays a bunch of code that suggests the operation was a success. But when I navigate to http://localhost:3000 I get the message "This webpage is not available."
Taking another look at my Terminal code, I see a couple apparent problems at the very beginning:
rails new path/to/your/new/application
Invalid application name application. Please give a name which does not match one of the reserved rails words.
My-MacBook-Pro:~ myname$ cd path/to/your/new/application
-bash: cd: path/to/your/new/application: No such file or directory
My-MacBook-Pro:~ myname$ rails server
Can anyone explain what's going on and how I can fix it?
It looks like what is happening is that you've named your application 'application', and this is what's causing errors in your rails setup. 'application' is a keyword used internally by Rails, and is probably throwing it off.
I've always used rvm instead of rbenv. It's easy to set up on Mac OSX Yosemite using curl, and I've never had any problems installing Rails on it. Are you tied to rbenv for some reason? If not, give rvm a try : https://rvm.io/rvm/install
Trying to run passenger-install-apache2-module which exits with error message:
Unable to autodetect the currently active RVM gem set name. This could happen if you ran this program using 'sudo' instead of 'rvmsudo'. When using RVM, you're always supposed to use 'rvmsudo' instead of 'sudo!'.
Please try rerunning this program using 'rvmsudo'. If that doesn't help, please contact this program's author for support.
I am not running it via sudo command. RVM is installed globally in /usr/local/rvm/bin/rvm. I'm on RHEL 6.
Have you tried to run the mentioned rvmsudo.
I would check first of all whether your RVM installation is valid and functional.
Activating Ruby environment with rvm did the trick.
After wrestling with this for quite some time I switched from rvm to rbenv and this completely cleared up. My theory is that my system ruby#2.4.1 was somehow being invoked by passenger instead of the ruby I wanted to use #2.4.4 and rbenv just doesn't have this issue.
I had rails working fine for several weeks but I tried to install PostgreSQL to match Heroku and it failed to work. Now, when I open the terminal it pretend rails is not there and sets the default ruby to 1.8.7. When I start RVM it finds the right version of ruby and finds rails again and can start the server but each time I open a new shell it's back to not finding anything. Plus, the git commands don't work even after starting rvm.
I have set rvm to start by default but that doesn't work either, it has to be started manually, and it still doesn't fix the git issue.
More Detail
I am installing on Mountain Lion. This already has Postgres but the tutorial I was using suggested installing fresh using Homebrew. The trouble was the Homebrew installation installs to /usr/local/var/postgres and the installed ppstgres installs to usr/var/postgres. The system automatically uses the usr/var/postgres version, so following the tutorial I chnaged the order of usr/local/bin and usr/bin in etc/paths. That didn't help so I changed it back. Everything then went to hell so I reinstalled Mountain Lion but nothing had changed.
There are two known problems with loading RVM & default ruby:
login shell: go to terminal emulator preferences and enable login shell, sometimes it might be required to use /bin/bash --login instead.
ZSH (+ Oh-My-ZSH): go to ~/.zshrc and comment out any lines starting with: PATH= or path=(, it is still possible to use those but they need to reference itself like: PATH=$PATH:HOME/.rvm/bin or path+=( $HOME/.rvm/bin ) - which update and not reset PATH. This might be a bug in terminal emulator or ZSH ...
The git issue is explained by the reinstall of Mountain Lion which did not automatically install the command line tools. That now works. The only pain is having to load rvm every time now.