If you run into trouble installing Rmagick on Ubuntu, it is most likely because you do not have the dev libraries installed that are needed by the rmagick Ruby Gem. Run the following commands in your terminal and everything should work fine.
sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install imagemagick
sudo apt-get install libmagickcore-dev
sudo apt-get install libmagickwand-dev
gem install rmagick
After a new install of RVM on Ubuntu, you may run into the error “There was an error(23)” in conjunction with a file write or folder creation permission error. This is caused when, for some reason, RVM does not properly add your Ubuntu user to the RVM group after it was installed. To correct this error, you need to complete the following steps, and executing the following commands:
Execute in terminal:
rvm group add rvm "$USER"
Log out of Ubuntu and log back in. If it still fails, you may need to have RVM fix its system permissions with the command:
Execute in terminal:
If you are like me, you want the all dates and times to display throughout your application using the same format. This can be accomplished through the following procedure.
Create a new Rails ‘Initializer’ file in your application’s ‘/config/initializers’ directory titled ‘date_format.rb’ and then paste into that file the following Ruby script. Simply uncomment the format you wish to use for each of the types Date, DateTime, and Time.
#Date::DATE_FORMATS[:default] = “%Y-%m-%d” # 2013-11-03
#Date::DATE_FORMATS[:default] = “%B %e, %Y” # November 3, 2013
#Date::DATE_FORMATS[:default] = “%e %b %Y” # 3 Nov 2013
#Date::DATE_FORMATS[:default] = “%Y%m%d” # 20131103
#Date::DATE_FORMATS[:default] = “%e %b” # 3 Nov
#DateTime::DATE_FORMATS[:default] = “%Y-%m-%d” # 2013-11-03 14:22:18
#DateTime::DATE_FORMATS[:default] = “%B %e, %Y” # November 3, 2013 14:22
#DateTime::DATE_FORMATS[:default] = “%e %b %Y” # Sun, 3 Nov 2013 14:22:18 -0700
#DateTime::DATE_FORMATS[:default] = “%Y%m%d” # 20131103142218
#DateTime::DATE_FORMATS[:default] = “%e %b” # 3 Nov 14:22
#Time::DATE_FORMATS[:default] = “%Y-%m-%d %H:%M:%S” # 2013-11-03 14:22:18
#Time::DATE_FORMATS[:default] = “%B %d, %Y %H:%M” # November 3, 2013 14:22
#Time::DATE_FORMATS[:default] = “%a, %d %b %Y %H:%M:%S %z” # Sun, 3 Nov 2013 14:22:18 -0700
#Time::DATE_FORMATS[:default] = “%d %b %H:%M” # 3 Nov 14:22
#Time::DATE_FORMATS[:default] = “%Y%m%d%H%M%S” # 20131103142218
#Time::DATE_FORMATS[:default] = “%H:%M” # 14:22
If you are getting a build error from Gem when trying to install the PostgreSQL gem called ‘pg’ and you are using the PostgreSQL App instead of installing PostgreSQL via Brew or some other method, it is because Gem cannot find the PostgreSQL config in the standard locations. To correct this you need to provide Gem with the path to the config file stored within the PostgreSQL App’s internal folder structure.
This can be done as follows:
gem install pg
<update: for latest versions of Postgres.app>
gem install pg
Another way to accomplish this is:
gem install pg
Note: the latest version of the PostgreSQL App, at the time of this writing was 9.4, your version may be different. Make sure you change the 9.4 in the config path in the command above to the one you are using or it will not work. You can verify the path by opening Finder, going to the Applications folder, locating Postgres.app, right clicking and selecting ‘show package contents’. This will open up the app’s folder structure in Finder.
If you are trying to use new plugins for Gedit, the default text editor on Mint, you might run into a problem as a lot of the new plugins require Gedit >=3.0 and be default Mint comes with 2.30.
To fix this you need to first get rid of Gedit 2.30 completely by running the following commands in your terminal.
sudo apt-get purge gedit
sudo apt-get purge gedit-common
Once those commands have completed successfully you need to run these commands to get the 3.6.1 version.
sudo apt-get install gedit-common/quantal
sudo apt-get install gedit/quantal
Now that we have the correct Gedit version we can install the Ruby and Rails plugins for Gedit. That’s all there is to it!
$ sudo apt-add-repository ppa:ubuntu-on-rails/ppa
$ sudo apt-get update
$ sudo apt-get install gedit-gmate
$ sudo apt-get install gedit-plugins
When setting up a Ruby/Rails development environment utilizing Ubuntu 12.04 LTS you may find yourself running into issues with setting your RVM default Gemset.
I attempted to set the default Gemset using every possible combination of the command rvm –default use 1.9.3-p286@corerivalry but every time I closed my terminal and re-opened it my default Ruby was set, but my Gemset was continually being set back to (default).
After much searching and frustration I ran into the –rvmrc command which creates a file (.rvmrc) that specifies the Ruby version as well as the Gemset to use for an individual project. After running the command, each time I opened my terminal in my Rail application’s root folder my Ruby and Gemset are exactly what I intend them to be.
rvm use 1.9.3-p286@rails3 --rvmrc