OSX: install Node JS and npm in 5 mins

Prerequisites

Couple of prerequisites:

Install Node and npm

Once Homebrew is installed, it is very simple:

brew install node

That’s all….

If needed, to upgrade/update node

# update Homebrew
brew update
# update Node / Npm
brew upgrade node

and finally, to check current versions of Node JS/npm

node -v
npm -v

— END —

OSX : When OSX f***’ed my daily work because of systemstatsd

1st of all, a lottle bit of history: On june 2012, I bought a MacMini, then I upgraded it to 16 Gb RAM. Until couple of weeks ago, my MacMini was running quite fast for my day-to-day (development mainly) work. Then… I don’t know what happens, but suddenly, it has become slower and slower, and the HD was always on.

So, I tried couple of things : reboot, reboot and erase plist, … and so on. My HD was quite full; thus, I tried to remove a LOT of things (maily my virtual machines)

Finally, as I noticed in ‘top’ that a lot of data were constantly written, I used ‘sudo fs_usage’ and I discovered the “systemstatsd” process… This process is painful! Constantly writing, so slowing down the entire system!

I stopped it definitevely and the miracle happens ! My MacMini is back to normal ! Alleluiah!

So, couple of commands:

To STOP the systemstatsd:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.systemstatsd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.systemstats.daily.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.systemstats.analysis.plist

To START it again:

sudo launchctl load -F /System/Library/LaunchDaemons/com.apple.systemstatsd.plist
sudo launchctl load -F /System/Library/LaunchDaemons/com.apple.systemstats.daily.plist
sudo launchctl load -F /System/Library/LaunchDaemons/com.apple.systemstats.analysis.plist

And that’s it !!!

Setup Apache Cordova in OSX Yosemite for Android & iOS apps

To use Apache Cordova on OSX Yosemite, the prerequisites are:

  • brew
  • npm

I assume both are available. In this quick blog, I will assume you’d like to compile, build and emulate your app for Android and iOs. Please remember that Cordova is also available for Window Phone 8, Firefox OS, … See Apache Cordova HomePage for details.

  1. Install ant using brew
    sudo brew update
    sudo brew install ant
    
  2. Check ant version:
    ant -version
  3. Install Cordova using npm
    sudo npm install -g cordova
    
  4. if you plan to compile cordova app for android, set ANDROID_HOME to point to Android SDK
    export ANDROID_HOME=~/android/sdk/
  5. If you plan to compile cordova app for iOS, install XCode from Apple Store
    https://itunes.apple.com/en/app/xcode/id497799835

    Then, you will need iOS Simulator from PhoneGap to test your app into iOS emulator:

    sudo npm install -g ios-sim
    

To make a small test project on OSX, please read Apache Cordova Starting Guide.

[To be continued]