Writing Lua on Mac

Install lua on mac I’m not sure that whether Lua is built on mac originally. (Ok, tested on Mac OSX 10.9, there is Lua in it.) So I installed Lua via Homebrew. Install homebrew (optional) ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" Install Lua by homebrew brew install lua Writing Lua You can use command: lua to interact with lua. (just like php -a or irb) print("Hello World") function fact(n) if n == 0 then return 1 else return n * fact(n-1) end end print("enter a number:") num = io.

Continue reading

First of all, you need ‘brew’ (http://brew.sh/) $ brew update $ brew install openssl $ brew link --force openssl $openssl version -a If it’s still the old version, you shoud: $ sudo rm /usr/bin/openssl #remove the old binary $ sudo ln -s /usr/local/Cellar/openssl/1.0.1h/bin/openssl /usr/local/bin (1.0.1h -> the latest version) ref: http://apple.stackexchange.com/questions/126830/how-to-upgrade-openssl-in-os-x

Continue reading

最近在開 mac 的 iTerm.app 或者是內建的終端機都覺得卡卡的, 之前以為是 .bashrc 載入太多東西導致的,所以把一些掛載的 bin 目錄都註解掉, 但是還是沒解決,心想不對勁,就順手 google 了一下… 我執行了下列語法: $ time /usr/libexec/path_helper PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ABC/android-sdks/platform-tools:/Users/ABC/android-sdks/tools:/Application/Vagrant/bin"; export PATH; real 0m0.043s user 0m0.001s sys 0m0.002s 接著我把 PATH 的內容寫進 .bash_profile,問題竟然就解決了… 速度飛快~~ 後來看到一篇 .bash_profile vs.bashrc 雖然大家都知道 .bash_profile 是在登入時執行(即是輸入帳號密碼時), 而 .bashrc 是在系統內非登入狀態時開啟 prompt 時執行, 但是!! Mac OSX 是個例外~是個例外~是個例外~…….=.= Mac OS X — an exception An exception to the terminal window guidelines is Mac OS X’s Terminal.app, which runs a login shell by default for each new terminal window, calling .

Continue reading

[Mac OSX] bash-it

bash-it: $git clone http://github.com/revans/bash-it.git ~/.bash_it $~/.bash_it/install.sh 他會幫你自動備份原來的 .bash_profile 為 .bash_profile.bak 所以別擔心 當他在問你要使用什麼 completion 或 script 之類的東西時, 選擇 ‘some’ 就可以自己選擇~ 有許多的 theme 及 package , completion 等等可以用,很方便! http://www.scholarslab.org/research-and-development/customizing-bash/

Continue reading

failed log: $sudo brew update error: Your local changes to the following files would be overwritten by merge: Library/Aliases/gperftools Library/Aliases/hashdeep Library/Aliases/htop Library/Aliases/nodejs Library/Aliases/ocio Library/Aliases/oiio .... error: The following untracked working tree files would be overwritten by merge: Library/Aliases/gperftools Library/Aliases/hashdeep Library/Aliases/htop Library/Aliases/nodejs Library/Aliases/ocio Library/Aliases/oiio .... Aborting Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master Solution: $ cd /usr/local $ git fetch origin $ git reset --hard origin/master reference [read]

Continue reading

Author's picture

kerkerj

Cat lover <3

Backend Engineer

Taiwan