I love coding but sometimes it just gets frustrating when you’re stuck on something particular for hours. In my case I were trying to add file uploads to my web app using paperclip and as soon as I were ready to upload an image rails returned an error saying I must install imagemagick. In today’s post I am going to share with you all how I have gotten this to work and hopefully this saves you hours of trying to find the right solution.
First things first, open your gemfile located in your rails root directory then add the following to your gemfile. Though this tutorial is fairly new I recommend checking the latest version to see where rmagick is currently at.
gem 'rmagick', '2.13.1'
When getting your mac you notice mac’s come without tons of programs which means you have to install them manually. After you have added rgmagick to your gemfile go to homebrew homepage.
Open your terminal and add the following code:
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
After running the above command run this command. Should start installing imagmagick this take a bit of time.
brew install imagemagick
If you get an error in rails saying
Errno::EACCES: Permission denied - /Users/path An error occured while installing rmagick (2.13.1), and Bundler cannot continue. Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
Go to the path where rmagick is(gems folder) and pull the folder to your desktop then create a new folder with the same name and finally copy the content from the first folder to your newly created folder. After you have successfully done so you should now have full permission. Finally go into your terminal and run bundle install command and everything shou