LoginSignup
2
3

More than 5 years have passed since last update.

僕のMacセットアップ記録

Last updated at Posted at 2017-11-26

概要

仕事でつかっていたMacがおかしくなったので、再セットアップしました。
その記録
コメントでこんなアプリいれると便利といったことを教えてもらえるとうれしいです。

僕について

ライブ配信系の会社につとめていて、
新しい技術・改善案を提案する仕事しています。

Linuxのサーバー側、iPhone、Android、webアプリといろいろ手を出しているので、それらの作業ができるよう環境を構築しないと・・・ですね。

まずはMac自体を調整

Macのアカウントを作ります。
今回は借りてきたPCで、もともとのアカウントがあるので、アカウントの追加でつくりました。
設定が面倒なので、iClowd経由でアカウントを設定しました。

ちなみに、このときはYosemite状態だったのでHigh sierraでどうなるかはよくわかりません。

High Sierraにしました。

OSXのバージョンをあげました。
これは貸与してもらったPCがYosemiteだったためです。

chrome・Firefoxの取得とインストール

chromeはアカウントでブックマークとか同期できますからね。
便利です。
あと検証用にFirefoxも一応いれておきます。

id_rsaを準備

https://qiita.com/suthio/items/2760e4cff0e185fe2db9
ここを参考に適当につくった。
id_rsa.pubのgithubアカウントとの紐付けをわすれずに

開発環境の調整

Xcodeのインストール

iPhone開発で必要になるxcodeのインストールを実施しておきます。
App Storeから入手しました。時間かかりますね。このインストール

Brewのインストール

homebrewでライブラリの管理したいので、インストールしました。
https://brew.sh/index_ja.html
ここの内容にしたがってコマンドを1つ実行するだけ

meld

いれようとおもいましたが、うまく動作しないみたいなので、スルーします。

caskで入れて以下を実施したら動作した。
https://qiita.com/qoAop/items/d76ea5d9b10c43bf1d6a

でも、そのまま

$ brew cask install meld

で、動作するものが入るようになりましたね。

0xED

binaryの内容を確認したりするのに利用しているツール
Hex Fiendをつかってましたが、いつのまにか0xEDが復活してますね。よかったよかった。
http://www.suavetech.com/0xed/0xed.html
ここからダウンロードして、~/Applicationにコピーしてインストール

ttLibC

自作して利用しているC言語のライブラリをgithubから取得しておく
ここで利用しているのが、だいたい変換系で利用しているもの

c言語のライブラリなので~/Documents/c/にcloneした。

automake

autotoolsを利用したプロジェクトをつくるのに必要なので、いれておく。

$ brew install automake

これでautomake、autoconfともに入る模様

cmake

cmakeを利用したプロジェクトを書く場合に必要

$ brew install cmake

ninjaもいれとく

$ brew install ninja

yasmとnasm

$ brew install nasm
$ brew install yasm

android ndk用のlibvpxコンパイルで必要になったので、実施

libtoolize

$ brew install libtool

jpeg-turboのコンパイルで必要になった。

nodeもいれとく

nodeのプログラムを書いたりnpmをつかってjavascriptやtypescriptのプロジェクト書いたりするので、nodeをいれておく。
https://qiita.com/sinmetal/items/154e81823f386279b33c

今回はnodebrewで
brewでいれたら6.x系だったので・・・
nodebrew経由にして9.x系いれたい。
なぜか~/.nodebrewと~/.nodebrew/srcのディレクトリをつくらないとだめっぽかった。

PATHの設定が面倒なので.bash_profileに$HOME/.nodebrew/current/binをPATHにいれるように調整しておいた。

terminalの設定

ターミナルを開いて環境設定 - プロファイル - シェル
を開いてシェルの終了時の動作を「ウィンドウを閉じる」に設定

VisualStudioCodeをいれる

https://code.visualstudio.com/
ここから入れる。

とりあえずbinaryのみの取得だったので~/Applicationにコピーした。
起動するのが面倒なので、aliasを設定しておく。

alias vscode="open -a visual\ studio\ code ."

これでターミナルで

$ vscode

と打つだけで、そのディレクトリがVisualStudioCodeで開く

ライブラリもろもろ

cute

ttLibCのunitテスト動作を実施するときに利用してる、ttLibCのReadmeにしたがって、headerデータを/usr/local/includeにいれとく

すでにはいってた

mp3lame x264 avcodec jpeg swscale swresample
ま、いいか仮PCだし、うごいたらいいや。

lameとx264はbrew経由ですでにはいっていて、latestみたいだった。
ffmpegは特になにも指定せずにはいっているみたいなので、調整しておこうと思う。

$ brew install ffmpeg --with-fdk-aac --with-libvorbis --with-libvpx --with-openh264 --with-opus --with-rtmpdump --with-speex --with-theora --with-x265

これでいってみる。

すでにはいっていたライブラリの影響か、brewでインストールしたライブラリのincludeファイルがおかしくなっていたので、chmodで変更してまわった。
なぜか644?になってたので、755に書き換えてまわった。

はいってなかった

現状このあたりはない。
faac:brewで入れました。今回はなしで・・・すでにfdkaacで済んでるし
faad:同上なくていい、必要ならavcodecでdecodeするし
daala:あとで余力があったらいれる。たぶん、av1使うからいれることないと思う。
speexdsp: brewでいれた。
soundtouch:いれる。
libyuv:いれる。

libyuvから
https://chromium.googlesource.com/libyuv/libyuv/

まずcloneする。

$ cd Documents/c/
$ git clone https://chromium.googlesource.com/libyuv/libyuv
$ cd libyuv
$ vi CMakeLists.txt
$ mkdir build
$ cd build
$ cmake ..
$ sudo make install

CMakeLists.txtをいじっているのは
https://chromium.googlesource.com/libyuv/libyuv/+/master/CMakeLists.txt#41
この次の行に

target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY})

これを追記しないと、jpegのlibraryが見えずにコンパイルがこける。
linuxだと問題なかったはず。

soundtouch

brew install sound-touch

これで済んだ

この時点でttLibCのコンパイルが
faac faad daalaenc daaladec webrtc libyuvがoffでコンパイルしてcuteのユニットテストも実行可能になっているので、ひとまずよしとしたいと思う。

faac

$ brew install faac

これでOK

ttLibC

$ cd Documents/c/
$ git clone git@github.com:taktod/ttLibC
$ cd ttLibC
$ autoreconf
$ ./configure --enable-all --enable-test

Result ...
license: GPLv3
debug:            on
test:             on
file feature:     on
socket feature:   on
opencv:           on
openal:           on
mp3lame(encoder): on
mp3lame(decoder): on
faac(encoder):    on
faad(decoder):    off(faad library is missing.)
openh264:         on
x264:             on
x265:             on
theora:           on
daala(encoder):   off(daalaenc library is missing.)
daala(decoder):   off(daaladec library is missing.)
vorbis(encoder):  on
vorbis(decoder):  on
speexdsp:         on
speex:            on
opus:             on
avcodec:          on
jpeg:             on
apple:            on
webrtc:           off(no compile data detection.)
soundtouch:       on
fdkaac:           on
libyuv:           on
swscale:          on
swresample:       on

こんな状態になった

やること:とりあえずあとでlibyuvのヘッダ参照まわりの動作をなければ、/usr/local/をみにいくで調整しておきたい。

11/28追記:brewでfaac入れたのとlibyuvのconfigure動作を変更した結果、利用可能に変わりました。

ttLibJsGypをいれる。

$ cd Documents/node/
$ git clone git@github.com:taktod/ttLibJsGyp
$ cd ttLibJsGyp
$ git submodule init
$ git submodule update
$ npm install
$ node
> require(".")
> require(".")
{ Frame: { [Function: Frame] fromBinaryBuffer: [Function] },
  reader: 
   { FlvReader: [Function: FlvReader],
     MkvReader: [Function: MkvReader],
     WebmReader: [Function: WebmReader],
     Mp4Reader: [Function: Mp4Reader],
     MpegtsReader: [Function: MpegtsReader] },
  writer: 
   { FlvWriter: [Function: FlvWriter],
     MkvWriter: [Function: MkvWriter],
     WebmWriter: [Function: WebmWriter],
     Mp4Writer: [Function: Mp4Writer],
     MpegtsWriter: [Function: MpegtsWriter] },
  decoder: 
   { AudioConverterDecoder: { [Function: decoder] enabled: true },
     AvcodecVideoDecoder: { [Function: decoder] enabled: true },
     AvcodecAudioDecoder: { [Function: decoder] enabled: true },
     JpegDecoder: { [Function: decoder] enabled: true },
     Mp3lameDecoder: { [Function: decoder] enabled: true },
     Openh264Decoder: { [Function: decoder] enabled: true },
     OpusDecoder: { [Function: decoder] enabled: true },
     SpeexDecoder: { [Function: decoder] enabled: true },
     TheoraDecoder: { [Function: decoder] enabled: true },
     VorbisDecoder: { [Function: decoder] enabled: true },
     VtDecompressSession: { [Function: decoder] enabled: true } },
  encoder: 
   { AudioConverterEncoder: { [Function: encoder] enabled: true },
     FaacEncoder: { [Function: encoder] enabled: false },
     FdkaacEncoder: { [Function: encoder] enabled: true },
     Mp3lameEncoder: { [Function: encoder] enabled: true },
     JpegEncoder: { [Function: encoder] enabled: true },
     Openh264Encoder: { [Function: encoder] enabled: true },
     OpusEncoder: { [Function: encoder] enabled: true },
     SpeexEncoder: { [Function: encoder] enabled: true },
     TheoraEncoder: { [Function: encoder] enabled: true },
     VorbisEncoder: { [Function: encoder] enabled: true },
     VtCompressSessionEncoder: { [Function: encoder] enabled: true },
     X264Encoder: { [Function: encoder] enabled: true },
     X265Encoder: { [Function: encoder] enabled: true },
     MSAacEncoder: { [Function: encoder] enabled: false },
     MSH264Encoder: { [Function: encoder] listEncoders: [Function], enabled: false } },
  resampler: 
   { AudioResampler: { [Function: resampler] enabled: true },
     ImageResampler: { [Function: resampler] enabled: true },
     SoundtouchResampler: { [Function: resampler] enabled: true },
     SpeexdspResampler: { [Function: resampler] enabled: true },
     SwresampleResampler: { [Function: resampler] enabled: true },
     SwscaleResampler: { [Function: resampler] enabled: true } },
  MsSetup: 
   { CoInitialize: [Function],
     CoUninitialize: [Function],
     MFStartup: [Function],
     MFShutdown: [Function],
     setlocale: [Function] },
  MsLoopback: { [Function: Loopback] listDevices: [Function] },
  rtmp: 
   { __esModule: true,
     NetConnection: [Function: NetConnection],
     NetStream: [Function: NetStream] } }

とりあえずちゃんとコンパイルできて、利用可能状態になってる模様。
よきかなよきかな

ttLibGoもやっとく

$ brew install go
$ go get github.com/taktod/ttLibGo
# github.com/taktod/ttLibGo/ttLibGoFaac
In file included from ttLibC.c:4:
src/github.com/taktod/ttLibGo/ttLibGoFaac/../ttLibC/ttLibC/encoder/faacEncoder.c:21:10: fatal error: 'faac.h' file not found
# github.com/taktod/ttLibGo/ttLibGoFfmpeg
In file included from ttLibC.c:4:
src/github.com/taktod/ttLibGo/ttLibGoFfmpeg/../ttLibC/ttLibC/decoder/avcodecDecoder.c:155:15: warning: 'avcodec_decode_audio4' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.4/include/libavcodec/avcodec.h:4943:1: note: 'avcodec_decode_audio4' has been explicitly marked deprecated here
/usr/local/Cellar/ffmpeg/3.4/include/libavutil/attributes.h:94:49: note: expanded from macro 'attribute_deprecated'
In file included from ttLibC.c:4:
src/github.com/taktod/ttLibGo/ttLibGoFfmpeg/../ttLibC/ttLibC/decoder/avcodecDecoder.c:426:15: warning: 'avcodec_decode_video2' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.4/include/libavcodec/avcodec.h:4992:1: note: 'avcodec_decode_video2' has been explicitly marked deprecated here
/usr/local/Cellar/ffmpeg/3.4/include/libavutil/attributes.h:94:49: note: expanded from macro 'attribute_deprecated'

goのpkgをさかのぼってみたところ

$ ls -l
total 7200
-rw-r--r--  1 taktod  staff  593990 11 25 20:31 ttLibGo.a
-rw-r--r--  1 taktod  staff  214594 11 25 20:31 ttLibGoFdkaac.a
-rw-r--r--  1 taktod  staff  265724 11 25 20:31 ttLibGoFfmpeg.a
-rw-r--r--  1 taktod  staff  195336 11 25 20:31 ttLibGoJpeg.a
-rw-r--r--  1 taktod  staff  227946 11 25 20:31 ttLibGoLibyuv.a
-rw-r--r--  1 taktod  staff  195622 11 25 20:31 ttLibGoMp3lame.a
-rw-r--r--  1 taktod  staff  277728 11 25 20:31 ttLibGoOpenh264.a
-rw-r--r--  1 taktod  staff  199282 11 25 20:31 ttLibGoOpus.a
-rw-r--r--  1 taktod  staff  200762 11 25 20:31 ttLibGoSoundtouch.a
-rw-r--r--  1 taktod  staff  195112 11 25 20:31 ttLibGoSpeex.a
-rw-r--r--  1 taktod  staff  190800 11 25 20:31 ttLibGoSpeexdsp.a
-rw-r--r--  1 taktod  staff  197086 11 25 20:31 ttLibGoTheora.a
-rw-r--r--  1 taktod  staff  196914 11 25 20:31 ttLibGoVorbis.a
-rw-r--r--  1 taktod  staff  243950 11 25 20:31 ttLibGoX264.a
-rw-r--r--  1 taktod  staff  260012 11 25 20:31 ttLibGoX265.a

こうなってた。
よきかなよきかな

テスト用のリソースデータを別のPCから取得

test.h264.aac.mp4といった変換動作テストに利用しているデータを別のPCからscpコマンドでコピーを実施
これで必要なものはそろったはず。

この時点であと80Gほどになった。
もともと113Gあった。

webrtcのコードをgclientで取得するのはちょっときびしいか_な・・・

AndroidStudio準備

https://developer.android.com/studio/index.html
からAndroidStudioを取得してインストールしておく

指示にしたがって順番にいれるだけ
Projectのlocationだけ~/Documents/androidにしたいが・・・

ndkのtoolchainも準備しておく。
これはすでに資料があるので、それにしたがってやるだけ。

r14bを利用するとplatform=android-8は利用できないみたいですね。9以降サポートか・・・

ここまでで10Gも食われた・・・

emscriptenやっておこう。

https://kripken.github.io/emscripten-site/
ここからDownloadする
とりあえずemsdk-portable.tar.gzを入手した。
emsdk-portableを~/tools/にコピー

$ cd ~/tools/emsdk-portable
$ ./emsdk update
$ ./emsdk install latest
$ ./emsdk activate latest
$ export PATH=~/tools/emsdk-portable/emscriptem/1.37.22/

この状態でjavaが必要らしいのでjdk8も取得する。

とりあえず過去につくったemscriptenをつかうライブラリをコンパイルしてみる。

ttLibJsEmc_nextしとく

$ cd Document/node/
$ git clone git@github.com:taktod/ttLibJsEmc_next
$ cd ttLibJsEmc_next
$ ./native/makenative.sh
$ npm install
$ npm run build

ttLibJsEmc_nextに問題があって時間かかったけど、最終的にこれで完了するようになったのでよしとしよう。

php56を入れておく

仕事の関係でphp5系のextensionも作っているのでそれ用の準備もしておきます。

$ brew update
$ brew upgrade
$ brew tap homebrew/homebrew-php
$ brew info php56
$ brew install php56

note: 昔のライブラリとしては、/usr/includeに入っていたみたいだけど、Sierraから/usr/includeというディレクトリが作成不能になったので、コンパイルコードがわを調整する必要がある。
(GDのincludeとか参照したいため、これが入ってる。)

boost入れる

$ brew install boost

終わりに

リストアップしてみたところ
特にかわったものを準備している感じではないですね。
editorは基本 Visual Studio Codeでいじる。
コンパイル等は ターミナルで実施するので特に・・・

2
3
0

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
2
3