Goal
- macにNode.jsとTypeScriptをインストールしてtscコマンドを実行するまで
Log
% echo $OSTYPE darwin12.0 % % brew search nodejs nodejs % sudo brew install nodejs Password: Warning: Your Xcode (4.6.2) is outdated Please install Xcode 4.6.3. ==> Downloading http://nodejs.org/dist/v0.10.13/node-v0.10.13.tar.gz ######################################################################## 100.0% ==> Patching patching file tools/gyp/pylib/gyp/xcode_emulation.py ==> ./configure --prefix=/usr/local/Cellar/node/0.10.13 ==> make install (beer) /usr/local/Cellar/node/0.10.13: 1085 files, 15M, built in 2.2 minutes % node --version v0.10.13 % brew search npm npm % sudo brew search npm Password: Warning: Your Xcode (4.6.2) is outdated Please install Xcode 4.6.3. Warning: node-0.10.13 already installed % which npm /usr/local/bin/npm # # 入っとったわ # % npm --version 1.3.2 % % npm search typescript npm WARN Building the local index for the first time, please be patient # 時間かかるから我慢してね、ってwarningでもないと思うんだけど( ゚Д゚) npm http GET https://registry.npmjs.org/-/all npm http 200 https://registry.npmjs.org/-/all NAME DESCRIPTION AUTHOR DATE VERSION KEYWORDS # 中略 typescript TypeScript is a language for application scale JavaScript development =typescript 2013-06-28 21:58 0.9.0-1 # 後略 % sudo npm install typescript Password: npm http GET https://registry.npmjs.org/typescript npm http 200 https://registry.npmjs.org/typescript npm http GET https://registry.npmjs.org/typescript/-/typescript-0.9.0-1.tgz npm http 200 https://registry.npmjs.org/typescript/-/typescript-0.9.0-1.tgz typescript@0.9.0-1 node_modules/typescript % tsc --version zsh: command not found: tsc # # typescriptのbinにパス通ってない # % tree ~/node_modules/typescript /Users/otiai10/node_modules/typescript ├── CopyrightNotice.txt ├── LICENSE.txt ├── README.txt ├── ThirdPartyNoticeText.txt ├── bin │ ├── lib.d.ts │ ├── tsc │ ├── tsc.js │ └── typescript.js └── package.json 1 directory, 9 files % % echo $PATH /Users/otiai10/.pyenv/shims:/Users/otiai10/.pyenv/bin:/usr/local/bin/gcc-4.9:/Users/otiai10/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin % export PATH=$PATH:~/node_modules/typescript/bin % which tsc /Users/otiai10/node_modules/typescript/bin/tsc % % tsc --version Version 0.9.0.1 % % cd ~/prj % ls -la drwxr-xr-x 4 otiai10 staff 136 7 18 20:16 . drwxr-xr-x+ 33 otiai10 staff 1122 7 21 13:33 .. drwxr-xr-x 4 otiai10 staff 136 7 20 18:56 iOS drwxr-xr-x 4 otiai10 staff 136 7 18 17:16 python % mkdir node % cd node % mkdir ts.test % cd ts.test % vi app.ts % cat app.ts console.log('hoge'); % tsc app.ts # .tsファイルをコンパイルして.jsファイルを生成してる # 今回はconsole.logだけなので何も変わらへんけど % ls -la total 16 drwxr-xr-x 4 otiai10 staff 136 7 21 13:39 . drwxr-xr-x 3 otiai10 staff 102 7 21 13:38 .. -rw-r--r-- 1 otiai10 staff 22 7 21 13:39 app.js -rw-r--r-- 1 otiai10 staff 21 7 21 13:39 app.ts # できとる。nodejsで実行 % % node app.js hoge %
インストールできたけど、これだけじゃ何とも言えないすな(;^ω^)