検証OS
CentOS 6.6
必要パッケージのインスコ
[user@localhost ~]$ sudo yum install -y gcc gcc-c++ git
Linuxbrewをインスコ
[user@localhost ~]$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
==> This script will install:
/home/vagrant/.linuxbrew/bin/brew
/home/vagrant/.linuxbrew/Library/...
/home/vagrant/.linuxbrew/share/man/man1/brew.1
Press RETURN to continue or any other key to abort # これが表示されたら "Enter"
==> Downloading and installing Homebrew...
Warning: /home/vagrant/.linuxbrew/bin is not in your PATH.
==> Installation successful!
==> Next steps
Install the Linuxbrew dependencies:
Debian, Ubuntu, etc.:
`sudo apt-get install build-essential`
Fedora, Red Hat, CentOS, etc.:
`sudo yum groupinstall 'Development Tools'`
See http://brew.sh/linuxbrew/#dependencies for more information.
Run `brew doctor` before you install anything
Run `brew help` to get started
+ 2015/12/02 追記
rootユーザーでやろうとしたら
Don't run this as root!
って怒られました、なるほどね!
Install the Linuxbrew dependencies:
とのこと。後述のsudo yum groupinstall 'Development Tools'
をシェルで実行
PATH
それぞれを追記。
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
export LD_LIBRARY_PATH="$HOME/.linuxbrew/lib:$LD_LIBRARY_PATH"
???
エラー中に入れろと言われたので・・・・
(後で調べます・・・)
[user@localhost ~]$ sudo git clone https://github.com/Homebrew/homebrew-dupes /home/vagrant/.linuxbrew/Library/Taps/homebrew/homebrew-dupes --depth=1
[user@localhost ~]$ brew update
チェック
brew doctor
とシェルに打ち込みチェックをする。
@問題なしの場合
[user@localhost ~]$ brew doctor
Your system is ready to brew.
@警告ありの場合
[user@localhost ~]$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git
ここでWarningが・・・。現在のyum installで得られるGitのバージョンが「1.7.1」だったので
「古いバージョンが入っているよ」という警告。というわけで・・・
Gitをインスコ
[user@localhost ~]$ brew install git
==> Tapping homebrew/dupes
Initialized empty Git repository in /home/r-hidaka/.linuxbrew/Library/Taps/homebrew/homebrew-dupes/.git/
remote: Counting objects: 40, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 40 (delta 0), reused 2 (delta 0), pack-reused 0
Unpacking objects: 100% (40/40), done.
Tapped 37 formulae (99 files, 608K)
==> Installing dependencies for git: xz, expat, homebrew/dupes/tcl-tk
==> Installing git dependency: xz
Error: xz cannot be built with any available compilers.
To install this formula, you may need to:
brew install gcc # エラー!
[user@localhost ~]$
「gcc
が必要だけど無いぞ!」と怒られる。
本当になければsudo yum install -y gcc
は必要です。ですが、恐らくそれでも同じエラーが出ます。
このサイト様によると「homebrewのgccの存在チェック方法が問題らしく見つけきってない」そうな。
なので、以下のようにhomebrewのディレクトリにシンボリックリンクを貼ることで解決させる。
[user@localhost ~]$ gcc -dumpversion
4.4.7 # バージョンを調べて4.4系であれば以下のコマンドでおk
[user@localhost ~]$ ln -s `which gcc` `brew --prefix`/bin/gcc-4.4
[user@localhost ~]$ brew install git
==> Installing dependencies for git: xz, expat, homebrew/dupes/tcl-tk
==> Installing git dependency: xz
==> Downloading https://fossies.org/linux/misc/xz-5.2.1.tar.gz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/home/r-hidaka/.linuxbrew/Cellar/xz/5.2.1
==> make install
/home/r-hidaka/.linuxbrew/Cellar/xz/5.2.1: 65 files, 1.9M, built in 3.1 minutes
==> Installing git dependency: expat
==> Downloading https://downloads.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz
==> Downloading from http://jaist.dl.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/home/r-hidaka/.linuxbrew/Cellar/expat/2.1.0_1 --mandir=/home/r-hidaka/.linuxbrew/Cellar/expat/2.1.0_1/share/man
==> make install
/home/r-hidaka/.linuxbrew/Cellar/expat/2.1.0_1: 11 files, 500K, built in 54 seconds
==> Installing git dependency: homebrew/dupes/tcl-tk
==> Downloading https://downloads.sourceforge.net/project/tcl/Tcl/8.6.4/tcl8.6.4-src.tar.gz
==> Downloading from http://jaist.dl.sourceforge.net/project/tcl/Tcl/8.6.4/tcl8.6.4-src.tar.gz
######################################################################## 100.0%
==> Patching
patching file pkgs/sqlite3.8.8.3/generic/sqlite3.c
==> ./configure --prefix=/home/r-hidaka/.linuxbrew/Cellar/tcl-tk/8.6.4 --mandir=/home/r-hidaka/.linuxbrew/Cellar/tcl-tk/8.6.4/share/man --enable-64bit
==> make
==> make install
==> make install-private-headers
==> Downloading https://downloads.sourceforge.net/project/tcl/Tcl/8.6.4/tk8.6.4-src.tar.gz
==> Downloading from http://jaist.dl.sourceforge.net/project/tcl/Tcl/8.6.4/tk8.6.4-src.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/home/r-hidaka/.linuxbrew/Cellar/tcl-tk/8.6.4 --mandir=/home/r-hidaka/.linuxbrew/Cellar/tcl-tk/8.6.4/share/man --with-tcl=/home/r-hidaka/.linuxbrew/Cellar/tcl-tk/8.6.4/lib --enable-64bit --enable-aqua=yes --without-x
==> make TK_LIBRARY=/home/r-hidaka/.linuxbrew/Cellar/tcl-tk/8.6.4/lib
/tmp/tcl-tk--tk20150805-15547-z1w8a5/tk8.6.4/unix/../generic/tkIntPlatDecls.h:408: error: expected ‘)’ before ‘*’ token
/tmp/tcl-tk--tk20150805-15547-z1w8a5/tk8.6.4/unix/../generic/tkIntPlatDecls.h:409: error: expected ‘;’ before ‘Window’
In file included from /tmp/tcl-tk--tk20150805-15547-z1w8a5/tk8.6.4/unix/../generic/tkStubLib.c:30:
/tmp/tcl-tk--tk20150805-15547-z1w8a5/tk8.6.4/unix/../generic/tkIntXlibDecls.h:34: error: expected ‘)’ before ‘*’ token
make: *** [tkStubLib.o] エラー 1
READ THIS: https://github.com/Homebrew/linuxbrew/blob/master/share/doc/homebrew/Troubleshooting.md#troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
https://github.com/homebrew/homebrew-dupes/issues
ここでmakeの時にエラーが吐かれたので、brew install git --without-tcl-tk
というオプション付きでコマンドをたたくと成功。
--without-(インストールさせないパッケージ名)かな?
git --version
か、 source ~/.bashrc && git --version
でバージョンが最新になっていれば成功