Using paperclip with imagemagick on macosx - ruby-on-rails

I am trying to use paperclip on macosx with phusion passenger. When i try to make an upload, apache give me :
dyld: Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/libtiff.3.dylib
Reason: Incompatible library version: libtiff.3.dylib requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
But when i run my rails application with rails server, everything works fine. When i try to use the identify command in my terminal as well.
Paperclip give me this error :
/Var/Folders/Nj/9xt2kprd01n3ssch3rd44pmh0000gn/T/Stream20120222-92627-1l2u297.Png Is Not Recognized By The 'Identify' Command.
Any idea? I am using MacOsx Lion

Further to my comment, I just had a similar problem and solved it as follows (not sure if this will work for you).
As per this homebrew/imagemagick issue, precompiled binaries may reference the wrong library versions when something else is upgraded.
Therefore, recompiling Imagemagick from source may help. For my own install, via Homebrew, this did it:
> brew uninstall imagemagick
> brew install imagemagick --build-from-source
My guess is that in your case Apache and/or Passenger may be calling a different version of Imagemagick, or operating as a different user with different load paths and therefore not finding the library.

I was running into this same issue on OS X 10.8 and reinstalling imagemagick from source had no effect but reinstalling libtiff from source did. yay! :)
brew uninstall libtiff
brew install libtiff --build-from-source
I found this out by using otool -L which showed that somehow libtiff was pointing to a newer version of libjpeg than installed on my system. reinstalling it from source causes it to link against the older version.
hope that helps!

Related

Error running '__rvm_make -j10' while installing ruby 2.6.5 on mac

I am trying to install the ruby 2.6.5 on mac having m1 pro chip but it's giving error of "__rvm_make -j10".
I tried to google but won't find error with "__rvm_make -j10". there is one question with the same error on stackoverflow and i tried the same method but it won't worked too.
i tried "rvm install 2.6.5 --with-out-ext=fiddle"
i tried with open ssl 1.0 too, but not any one worked.
sammalik#Sams-MacBook-Pro rubyporgram % rvm install 2.6.5
ruby-2.6.5 - #removing src/ruby-2.6.5 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/13.0/arm64/ruby-2.6.5.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating certificates bundle '/opt/homebrew/etc/openssl#1.1/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/sammalik/.rvm/rubies/ruby-2.6.5, this may take a while depending on your cpu(s)...
ruby-2.6.5 - #downloading ruby-2.6.5, this may take a while depending on your connection...
ruby-2.6.5 - #extracting ruby-2.6.5 to /Users/sammalik/.rvm/src/ruby-2.6.5 - please wait
ruby-2.6.5 - #configuring - please wait
ruby-2.6.5 - #post-configuration - please wait
ruby-2.6.5 - #compiling - please wait
Error running '__rvm_make -j10',
please read /Users/sammalik/.rvm/log/1668327329_ruby-2.6.5/make.log
There has been an error while running make. Halting the installation.
UPDATE: Here's an updated blog post I wrote with the possible options if you really must use Ruby 2.6.x: https://www.rubyonmac.dev/how-to-install-ruby-2-6-on-macos-13-ventura
Instead, I highly recommend updating your project to at least 2.7.7. Here's a detailed guide I wrote that shows How and Why to Upgrade the Ruby Version in Your Project
Ruby 2.6.x is no longer supported on any Mac that has version 14 or higher of Apple's command line tools, which would be the case on macOS Ventura (13.0). Assuming you have Homebrew installed, you can check which version you have by running brew config, and then look towards the bottom for the lines that starts with CLT: and Xcode:
Ruby 2.6 reached end of life in March 2022, so it should not be used in production for security reasons. A lot of people get stuck because they think they have to use the version of Ruby that's specified in the project's .ruby-version and/or Gemfile. Instead, it's recommended to update the project to a newer version.
In most cases, it would be as easy as following these steps:
Install Ruby 2.7.7
Replace "2.6.x" with "2.7.7" in .ruby-version and Gemfile, and any other file where the Ruby version is specified (except Gemfile.lock because it should never be edited manually)
Run bundle install
Update any gems if necessary
Run your tests and make sure your app still works
Now that you know the recommended approach, let's go over 2 solutions in case you have a special need to use Ruby 2.6 before you update to 2.7.7:
Install Ruby with Homebrew
Downgrade to version 13.4 of the command line tools
Install Ruby with Homebrew
Install Homebrew if you haven't already
Install Ruby 2.6.10: brew install ruby#2.6
Follow the instructions for setting your PATH. For example, Homebrew will say something like this:
By default, binaries installed by gem will be placed into:
/opt/homebrew/lib/ruby/gems/2.6.0/bin
You may want to add this to your PATH.
If you need to have ruby first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
The reason this works is because this is a pre-built version of Ruby that was compiled with version 13.3 of the command line tools. However, note that it's not officially supported.
Note that you'll need to disable RVM or any other version manager you might have used before. And you'll only be able to use 2.6.10 with this setup. You won't be able to switch to other versions that you might have installed with RVM or another version manager.
This is meant as a temporary solution so that you can run your project with 2.6.10 and then update it to 2.7.7. Also, note that either way, you will need to update your project to at least 2.6.10. There's absolutely no reason to use 2.6.5. You should always make sure your apps are running the latest version in a series. For 2.6, it's 2.6.10, for 2.7, it's 2.7.7, then 3.0.5, and 3.1.3.
Downgrade to version 13.4 of the command line tools
This is not possible on macOS Ventura (13.0), so don't waste your time trying. If you're on macOS Monterey, you can download version 13.4 of the command line tools from Apple's developer site, and then install them. I also wrote step-by-step instructions for installing version 13.4 of the command line tools if you need them.
The following works fine with macOS Ventura 13.1. You have to choose an older openssl version e.g. openssl#1.0.2t
Make sure you have home-brew installed /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(Optional) Check if you already have openssl versions installed via home-brew. Uninstall not ncessary versions brew uninstall openssl
Install openssl via home-brew: brew install openssl#1.0.2t
Check the path where your local home-brew packages go. In my case it is /usr/local/opt/openssl#1.0/.
Install ruby with rvm rvm install 3.1.3 --with-openssl-dir=/usr/local/opt/openssl#1.0/
I've been through a similar problem in Ubuntu 22.10. Here are some points that may help you:
Your OpenSSL may be too updated and probably has some breaking changes that don't allow some of your ruby C files to be compiled. Download a previous version at OpenSSL website, install it in a different location than your current version and use rvm install --with-openssl-dir=<old-openssl-dir> 2.6.5 as mentioned in Chris' answer.
Instead of using --with-openssl-dir option, you could add your old OpenSSL /bin and /include files directly in environment variables in your rvm command, like this: PATH=<old-openssl-bin-path>:$PATH C_INCLUDE_PATH=<old-openssl-include-path>:/usr/include rvm install 2.6.5. This could be useful in the case that --with-openssl-dir option isn't available for some reason. You also need to create links to the /lib files in your old OpenSSL folder. You'll probably find paired files like libssl.so and libssl.so.1.1. You can just move the version-named files into /usr/lib(or similar for macos), otherwise when you execute openssl command from your old OpenSSL folder, it will probably raise an error saying that openssl can't find libraries. If you choose to use this method, make sure that your rvm user bin files (at ~/.rvm/usr/bin) don't contain any files that may mess the ruby installing (like another openssl executable). You may get rid of this folder using rvm pkg remove.
Another possible solution is changing your gcc version. My OS came with gcc version 12.2.0, which comes with a change in computer gotos that failed my make step. To find errors in your ruby installation, check the make.log file specified at the rvm command error message and look for lines like this:

Specifically installing libldap-2.5.0 with Homebrew

Running PHP#7.2 which requires version 2.5.0 of this lib or I get this error:
dyld: Library not loaded: /usr/local/opt/openldap/lib/libldap-2.5.0.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
If I try the typical brew reinstall openldap libiconv solution, this installs 2.6.0 which PHP 7.2 won't use.
I've tried brew install openldap#2.5.0 but that doesn't work.
How can I get the older version 2.5.0 back on my system?
Install PHP 7.2 from the shivammathur/php tap:
(First, I recommend making a copy of /usr/local/Cellar/php#7.2 as a backup, in case any non-default files have been installed there.)
brew uninstall php#7.2
brew install shivammathur/php/php#7.2
How can I get the older version 2.5.0 back on my system?
#eComEvo you may want to improve the question by stating your system.
#fn-control-option you may want to improve your answer by providing the reader with information such as "its not a system specific issue" or the like.

Trying to install rails, but I get the error "i386 architecture is deprecated on macOS."

The full text of the error
The most important line, to my untrained eye, seems to be: ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
But am I really supposed to modify the Xcode build settings?
I am trying $ sudo gem install rails.
My specs:
macOS High Sierra 10.13.6
Xcode version: 10.0 (10A255)
Ruby version: 2.3.7p456
Gem version: 2.7.8
Recommendations I've found so far:
1) Install xcode command line tools. They are installed.
2) bundle config build.nokogiri --use-system-libraries.
/\ I've read that I should not do this.
Any help would be greatly appreciated!
As #anothermh mentioned, you shouldn't use system ruby. I'd mention further that you don't want to, and shouldn't need to, run sudo to install gems.
Use a ruby version manager such as asdf (my recommended), rvm (probably one of the most popular), or rbenv (also a solid choice).
I'd also recommend, if you haven't done it already, that you grab homebrew because you'll need a few dependencies. Highly recommend at least:
brew install gcc libxml2 readline
I've tried to bundle install and had issue like this. In my case upgrading rails from 4.2.5. to 4.2.9 fixed error. Maybe it will help someone to not lose time.

Inspect or clean up the working tree error when installing Ruby 2.1.3 on Mac OS X 10.9.5

I'm trying to install Ruby 2.1.3 on Mac OS X 10.9.5 using the rbenv install 2.1.3 command. However I get the error message below. I tried every suggestion on stack overflow and elsewhere. Nothing seems to be working. I currently have the original ruby version that came with 10.9.5, Ruby 2.1.3p242. Brew doctor says everything is fine and rbenv is up to date. Thanks so much! Trying to learn Ruby and Ruby on Rails but I can't get passed this stage.
Inspect or clean up the working tree at /var/folders/zg/s1jqg94n0hjggdnmb442n2lc0000gn/T/ruby-build.20141025184549.88303
Results logged to /var/folders/zg/s1jqg94n0hjggdnmb442n2lc0000gn/T/ruby-build.20141025184549.88303.log
Last 10 log lines:
linking shared-object openssl.bundle
installing default openssl libraries
compiling raddrinfo.c
compiling ifaddr.c
installing default socket libraries
compiling init.c
compiling constants.c
linking shared-object socket.bundle
linking shared-object ripper.bundle
make: [build-ext] Error 2
I have a m1 mac and I also got this error installing ruby,
this command worked for me:
export optflags="-Wno-error=implicit-function-declaration";
run this and then try rbenv install again.
Did you try this:
CC=/usr/bin/gcc rbenv install 2.1.3
From this SO answer: Unable to build Ruby 2.1.3 on OSX 10.10 GM 3.0 with rbenv
I had to remove the existing openssl that came with macOS and instead install from brew with brew install openssl.
NOTE: I also had to disable SIP with csrutil disable and then remount root with writable permissions, with sudo mount -uw /.

imagemagick identify gives "dyld: Library not loaded: /usr/local/lib/libtiff.3.dylib"

after brew install imagemagick and brew install ghostscript on osx
when i run identify i get:
$ identify
dyld: Library not loaded: /usr/local/lib/libtiff.3.dylib
Referenced from: /usr/local/bin/identify
Reason: image not found
Trace/BPT trap: 5
this fixes it
ln -s /usr/local/Cellar/libtiff/3.9.5/lib/libtiff.3.dylib /usr/local/lib/libtiff.3.dylib
thanks to rlaraujo on this link https://github.com/mxcl/homebrew/issues/12099
I ran into the same problem recently on 10.6.8. I had ImageMagick installed (from way back) and then installed freetype and ghostscript and started getting the failure. The fix for me was simply to upgrade ImageMagick, which rebuilt and linked up to the newer libtiff and other libraries.
brew upgrade imagemagick
I ran into a similar problem with libpng library when I tried to use convertcommand with png files.
I first tried upgrading imagemagick but there were no upgrades available for the current version of brew I had. Updating brew and then upgrading ImageMagick solved the problem.
brew update
brew upgrade imagemagick

Resources