LoginSignup
26
19

More than 5 years have passed since last update.

homebrewで過去のバージョンインストールする方法

Posted at

はじめに

使用しているrmagickが最新のImageMagickをフォローしていなかったため、homebrewで過去のバージョンをインストールしようとしたら詰まったのでメモします。

homebrewはバージョンを指定してインストール出来ない

homebrewにはパッケージをバージョン指定をしてインストールするコマンドがありません。なので git checkout を使って目的のバージョンのimagemagickをインストールします。

インストールしたいバージョンのリポジトリを探す

以前のhomebrewで使えていたbrew versionsコマンドで過去のversionを調べることが出来たが、現在はそのコマンドは削除されているので、brew log imagemagickを使ってインストールしたいバージョンのリポジトリを探します。

/usr/local$ brew log imagemagick |grep "探しているバージョン"
Warning: The git repository is a shallow clone therefore the filtering may be incorrect.
Use `git fetch --unshallow` to get the full repository.

インストールしたいバージョンのリポジトリをチェックアウト

フォーミュラが格納されているディレクトリに移動する。
※Homebrew本体がインストールされる先が 1.0.0 からは /usr/localから/usr/local/Homebrewに一つディレクトリを掘ってインストールされるようになったらしいです。なので自分の場合は以下のディレクトリにフォーミュラが格納されていました。
参考:http://rcmdnk.github.io/blog/2016/09/29/computer-mac-homebrew-brew-file/

/usr/local& cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/

リポジトリをチェックアウトします。

git checkout 8c8d0fb5bf436d2b9232b5aeceb63b7ac66533d1 imagemagick.rb

指定したバージョンのImageMagickをインストール

/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/$ brew install imagemagick
==> Downloading https://homebrew.bintray.com/bottles/imagemagick-6.9.6-2.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring imagemagick-6.9.6-2.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/imagemagick/6.9.6-2: 1,460 files, 17.9M

インストールしたimagemagickのバージョンを確認

/usr/local$ brew info imagemagick
imagemagick: stable 6.9.6-2 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/imagemagick/6.9.3-10 (1,461 files, 17.9M) *
  Built from source on 2016-11-06 at 09:06:33
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick.rb
==> Dependencies
Build: pkg-config ✔
Required: libtool ✔, xz ✔
Recommended: jpeg ✔, libpng ✔, libtiff ✔, freetype ✔
Optional: fontconfig ✘, little-cms ✘, little-cms2 ✘, libwmf ✘, librsvg ✘, liblqr ✘, openexr ✘, ghostscript ✘, webp ✘, openjpeg ✘, fftw ✘, pango ✘
==> Requirements
Optional: x11 ✔, perl >= 5.5 ✔
==> Options
--with-fftw
    Compile with FFTW support
--with-fontconfig
    Build with fontconfig support
--with-ghostscript
    Build with ghostscript support
--with-hdri
    Compile with HDRI support
--with-liblqr
    Build with liblqr support
--with-librsvg
    Build with librsvg support
--with-libwmf
    Build with libwmf support
--with-little-cms
    Build with little-cms support
--with-little-cms2
    Build with little-cms2 support
--with-opencl
    Compile with OpenCL support
--with-openexr
    Build with openexr support
--with-openjpeg
    Build with openjpeg support
--with-openmp
    Compile with OpenMP support
--with-pango
    Build with pango support
--with-perl
    Compile with PerlMagick
--with-quantum-depth-16
    Compile with a quantum depth of 16 bit
--with-quantum-depth-32
    Compile with a quantum depth of 32 bit
--with-quantum-depth-8
    Compile with a quantum depth of 8 bit
--with-webp
    Build with webp support
--with-x11
    Build with x11 support
--with-zero-configuration
    Disables depending on XML configuration files
--without-freetype
    Build without freetype support
--without-jpeg
    Build without jpeg support
--without-libpng
    Build without libpng support
--without-libtiff
    Build without libtiff support
--without-magick-plus-plus
    disable build/install of Magick++
--without-modules
    Disable support for dynamically loadable modules
--without-threads
    Disable threads support
--HEAD
    Install HEAD version

これでインストール完了です!

26
19
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
19