Skip to content
July 12, 2016 / windperson

設定Mac OS開發環境

Mac電腦

命令列工具

  • 建議安裝iTerm2,原本內建的終端機沒有辦法很容易控制並提供多組啟動session的設定,並且要複製/貼上字串到命令列視窗很不順手。
  • iTerm2的功能說明請參考官網介紹:http://www.iterm2.com/features.html
  • 注意:如果有使用sourcetree並且設定預設命令列工具是iTerm2的話,請使用iTerm2 ver2.X的版本,直到sourcetree有 ver2.3.1之後的更新版釋出(問題原因請看此)。
     

應用程式套件管理工具

homebrew

  • 官網網址:http://brew.sh/
  • 安裝前要先設定命令列的預設"Command Line Build Tools":(參考此說明)
    1. 建議先在App Store下載安裝Xcode,但如果該機器是純粹用來做跑jenkins的build machine,可以不必裝。
    2. 在命令列執行: xcode-select --install
    3. 安裝完畢後的驗證:執行ls /Library/Developer/CommandLineTools,確認該目錄存在。
  • 安裝流程:
    1. 執行過程中會需要sudo權限,因此該帳號需要建立登入密碼。
    2. 將官網上那串ruby執行命令貼到命令列視窗上,按下enter執行。
    3. 執行完後,確認有"brew"這個指令列程式可用:執行which brew,確認/usr/local/bin/brew這個路徑的程式存在。
    4. 執行brew update && brew doctor,假如有顯示”Your system is ready to brew.“的字串表示homebrew去呼叫command line build tools能正常運作,安裝成功。
  • 安裝/更新/移除程式的方法
    • 安裝新的命令列程式,用以下指令:
      brew install [程式名稱]
    • 更新先前已經由homebrew安裝過的程式,用以下指令:
      brew upgrade [程式名稱]
    • 移除homebrew所安裝的程式,用以下指令:
      brew uninstall [程式名稱]

其他設定

允許非Mac App Store的程式執行

預設Mac OS X只會允許從App Store以及有效數位簽章的程式執行,在某些第三方OpenSource專案例如CocoaPods提供的App會變成下載後,即使放在應用程式目錄內,仍舊不能用點兩下的方式執行,必須打開權限才能夠讓這類的App執行。啟用的方法如下:
在命令列視窗執行:
sudo spctl --master-disable
執行時會需要sudo密碼,執行完畢後,可用sudo spctl --status查看或是從系統選單的[系統偏好設定]/[安全與隱私]/[一般]的最下方查看確實是勾選到最下一個的"允許任意位置"項目。

該指令的詳細說明可以參考官網

讓Xcode在執行時不會一直跳出允許提升權限(sudo)的提示視窗

在命令列執行:
DevToolsSecurity -enable
然後會顯示"Developer mode is now enabled"字串,啟用Developer mode成功。

該指令的詳細說明可以參考官網

Advertisements
January 19, 2016 / windperson

然而問題的重點在於,履歷必須對自己有意義,而不是去迎合一般人眼中的完美。無論之後會有多少人羨慕你:「你在XX工作,好厲害!」只要是無助於職涯目標的工作,就稱不上是好資歷。

January 19, 2016 / windperson

現在的世界就是分不出虛虛實實。

January 4, 2016 / windperson

Mount *nix folder via SSH FS/SFTP in Windows

Use dokany and Win-SSHFS:
  1. Install dokany driver according your windows version:
    https://github.com/dokan-dev/dokany/wiki/Installation#choose-a-version
    Note: currently v0.8.0 and above is not compatible with Win-SSHFS.
  2. Download Win-SSHFS release v1.5.12.8 zip file, extract it to a folder can execute.
    https://github.com/dimov-cz/win-sshfs/releases
    Note: currently v1.5.12.9 release has symbolic link bug.
  3. Run WinSshFS.exe which is in that extracted folder, create settings like following example: win_sshfs
  4. Click Mount in setting window right most button or in system tray menu: win_sshfs_mount
  5. And you will see a virtual driver and has the mounted folder as the setting "Mount folder" specified in File Explorer window.
     win_sshfs_mounted

And be sure to unmount when you want to disconnect the virtual file system:
win_sshfs_unmount

 

Reference:
December 30, 2015 / windperson

用ConEmu開PowerShell的方法

建立一個捷徑,捷徑內容就是
“C:\Program Files\ConEmu\ConEmu64.exe” /icon “%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe” /title “PowerShell” /cmd “powershell”
(這邊的情況是ConEmu 64bit版,所以路徑是C:\Program Files\ConEmu\ConEmu64.exe)這樣之後直接執行該捷徑就會有一個跑PowerShell的ConEmu視窗可以開始使用。
July 10, 2015 / windperson

Set NPM global module install location in Windows

To set global npm install location in windows: (here use D:\npm for example)

  1. Set those environment variables:

    Environment Variable Value
    npm_config_home D:\npm\home
    npm_config_prefix D:\npm
    npm_config_userconfig D:\npm\home\npmrc
  2. Create a text file called npmrc in D:\npm\home, which contains:

    save-prefix = ~
    
  3. Append the additional “D:\npm;” to %PATH% environment variable.

And now you can move the content in the %APPDATA%\npm folder to the new location D:\npm.

July 6, 2015 / windperson

Create Node.js latest verion RPM installer for CentOS 6&7

Since the node.js RPM installer in EPEL repository is old (v0.10.x), we can use “nodejs-rpm” to installable rpm package:

  1. Install necessary packages:
    • CentOS v7.x:
      sudo yum install -y gcc-c++ git make openssl-devel yum-utils rpmdevtools
    • CentOS v6.x:
      It need to install Python v2.7 and new version of GCC C++ compiler if you want to build Node.js v4.x RPM packages, and install following requirements:

      sudo yum install -y git openssl-devel yum-utils rpmdevtools
  2. Use git to get latest source of nodejs-rpm in Github:
    git clone https://github.com/kazuhisya/nodejs-rpm.git
  3. Use yum-builddep to config necessary rpm packages:
    cd nodejs-rpm;sudo yum-builddep -y ./nodejs.spec
  4. Build rpm package:
    • CentOS v6.x:
      scl enable python27 devtoolset-3 'make rpm'
    • CentOS v7.x:
      make rpm

The final rpm package files will place in nodejs-rpm/dist/ folder as:

  • CentOS v6.x:
    CentOS 6.x build node.js rpm result
  • CentOS v7.x:
    CentOS 7.x build node.js rpm result

Install as:
(Replace the [version] with current release node.js version number)

  • CentOS v6.x:
    sudo yum install -y nodejs-[version].el6.x86_64.rpm nodejs-npm-[version].el6.x86_64.rpm --nogpgcheck
    
  • CentOS v7.x:
    sudo yum install -y nodejs-[version].el7.x86_64.rpm nodejs-npm-[version].el7.x86_64.rpm --nogpgcheck