First time I install RoR app based on PostgreSQL database and after run the command rails new psql_app -d postgresql I get following problem:
...
create vendor/assets/javascripts/.gitkeep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:243:in `mkdir': Permission denied - /Users/adam/.gem/specs/rubygems.org%443 (Errno::EACCES)
from /Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:243:in `fu_mkdir'
from /Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:217:in `block (2 levels) in mkdir_p'
from /Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:215:in `reverse_each'
from /Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:215:in `block in mkdir_p'
from /Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:201:in `each'
from /Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:201:in `mkdir_p'
from /Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:125:in `fetch_spec'
from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/remote_specification.rb:47:in `_remote_specification'
from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/remote_specification.rb:53:in `method_missing'
from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/resolver.rb:101:in `block in __dependencies'
....
I also tried to re-set up the connection to PostgreSQL database, but without success… still getting this error. When I try to create a new app with MySQL database, I don’t get this error.
This is bundler not being able to write to your rvm folder. I expect that the reason it works with Mysql is that the appropriate gems are already installed and were probably installed using sudo and now you’re trying to run
rails newas your current useradam.You could use
sudo rails new psql_app -d postgresqlor alternatively you could fix the permissions in your~/.gemdirectory. To do this you can probably safely type:sudo chown -R adam ~/.gemThis should let you install gems without using sudo.