How can I avoid using sudo?
I am setting up ruby on rails on my mac ox yosemite, and along the way, I inevitably end up using 'sudo' for some of my commands. This helps me overcome the error below:
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
For more context, I am following this tutorial and in the section on Final Steps, I was unable to execute
rake db:create
because I needed to install pg and my user account isn't allowed to install to the system Rubygems.
I managed to overcome this problem from following the steps here (taken from this post)
Install Xcode command line tools (Apple Developer site)
brew uninstall postgresql
brew install postgresql
ARCHFLAGS="-arch x86_64" gem install pg
EXCEPT that the last step for me was
sudo ARCHFLAGS="-arch x86_64" gem install pg
Questions:
1) By using sudo - what is the implication on my computer?
2) How can I improve my set up to avoid having to use sudo?