カテゴリー : Homebrew

[Mac] Homebrew で apple-gcc42 をインストールする方法

Xcode 4.2.1 から gcc が llvmgcc とかいうのに変わってしまい、今までの gcc を使うためには別途インストールしないといけません。

■ llvmgcc

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

そこで、Homebrew で apple-gcc42 をインストールする方法を調べたので、ご紹介します。

まず、デフォルトの Formula には AppleGCC や GNU GCC はないので、github にある非公式Formulaから直接、インストールします。

Homebrew/homebrew-dupes

$ brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
==> Downloading http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg
######################################################################## 100.0%
==> Caveats
NOTE:
This formula provides components that were removed from XCode in the 4.2
release. There is no reason to install this formula if you are using a
version of XCode prior to 4.2.
 
This formula contains compilers built from Apple's GCC sources, build
5666.3, available from:
 
  http://opensource.apple.com/tarballs/gcc
 
All compilers have a `-4.2` suffix. A GFortran compiler is also included
and is the exact same version as the compiler provided by the `gfortran`
formula in the main repository.
==> Summary
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3: 106 files, 75M, built in 115 seconds

gcc-4.2 コマンドで apple-gcc42 が使えるようになりました。

$ gcc-4.2 -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /Volumes/Media/Builds/gcc-5666.3/build/obj/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

以上です。


参考情報

Build gcc 4.6.2 on Mac OS X Lion | Re: no subject

[JavaScript] Mac に Homebrew で SpiderMonkey をインストール

Mac に Homebrew で SpiderMonkey をインストールしました。

$ brew install spidermonkey

これで js コマンドでコンソールからJavaScript(SpiderMonkeyエンジンのもの)を実行することができます。

$ js
js> print('お腹すいた' + '、と思ったか?');
お腹すいた、と思ったか?
js> 
js> quit();
$

SpiderMonkey について知りたい方はこの辺を読んでください。

SpiderMonkey (JavaScript-C) Engine はてなブックマーク - SpiderMonkey (JavaScript-C) Engine

以上です。

[Mac] Homebrew をインストールしたら、”Warning: Now install Xcode: http://developer.apple.com/technologies/xcode.html”というエラーが出た

Mac をクリーンインストールして、Homebrew をインストールしたら下記のようなエラーが発生しました。

Warning: Now install Xcode: http://developer.apple.com/technologies/xcode.html

原因は、Xcodeをインストールしていないせいだったので、App StoreからXcodeをインストールしました。

ちなみに、Homebrewのインストール方法はこちらを参考にしてください。

・インストール方法:[Mac] Homebrew をインストール

以上です。

【参考】

Homebrewをインストールしました | blog.tokuda109.jp

[Mac] Homebrew で tree コマンドをインストール

Mac OS X にて、treeコマンドを使うために Homebrew でインストールしました。

Homebrewをまだインストールしていない方はこちらの記事を参考にして下さい。

[Mac] Homebrew をインストール | CodeNote.net はてなブックマーク - [Mac] Homebrew をインストール | CodeNote.net

■ tree コマンドのインストール

brew install でインストールするだけでOKです。

$ brew install tree
==> Downloading http://mama.indstate.edu/users/ice/tree/src/tree-1.6.0.tgz
######################################################################## 100.0%
==> make
==> make install
/usr/local/Cellar/tree/1.6.0: 6 files, 124K, built in 7 seconds

treeコマンドが使えるようになったので、試しに実行してみます。

$ tree
.
├── Gemfile
├── app.rb
├── config.ru
└── public
    ├── css
    └── js
 
3 directories, 3 files

treeコマンド便利!

[Mac] Node.js と npm をインストールする方法 [Homebrew]

Macに Node.js と npm をインストールする方法を調べたのでメモ。

node.js を homebrew でインストールする

$ brew install node

正常にインストールされたことを確認します。

$ node -v
v0.4.11

 

npm を homebrew でインストールできない…

Homebrew の npm formula は、収録のポリシーに沿わない( https://github.com/mxcl/homebrew/wiki/Acceptable-Formula )として最近、取り除かれたそうです。

メッセージにあるように curl http://npmjs.org/install.sh | sh でインストールすべきみたいです。

$ brew install npm
Error: No available formula for npm
npm can be installed thusly by following the instructions at
  http://npmjs.org/
 
To do it in one line, use this command:
  curl http://npmjs.org/install.sh | sh

 

npm を curl経由でインストールする

$ curl http://npmjs.org/install.sh | sh

正常にインストールされたことを確認します。

$ npm -v
1.0.103

以上です。


参考情報

node.jsとnpmのインストール – 自分の感受性くらい

MacOSXでnode.js/npm/nvmをインストール – tagomorisのメモ置き場

[MacOS] Homebrew で PostgreSQL をインストールする手順

Mac に Homebrew で postgresql をインストールしたので手順をご紹介します。

PostgreSQL

続きを読む

[macOS] Homebrew をインストール(ついでにGitもインストール)

macOS のパッケージ管理ツール Homebrew をインストールする方法をご紹介します。
(最終更新日:2020年4月9日)

・公式:Homebrew — MacPorts driving you to drink? Try Homebrew!

homebrewは、system に元から入っている環境をそのまま使うので、序盤の環境構築をサクサクできるというのがポイントみたいです。

続きを読む