Home > Technology > Installing Node.js on Mac OsX

Installing Node.js on Mac OsX

Node.js intrigued me and I wanted to hack with Node.js & CouchDB. I read about Node.js and wanted to install it on my Mac. Here is the guide to install Node.js quickly on Os X.

1. If you are running Snow Leopard then the process is simple. Download the latest package from http://sites.google.com/site/nodejsmacosx/ and install it. Done!!

2.If you haven’t upgraded to Snow Leopard and still running on Leopard (like me) then you have made your life miserable. I encountered with a problem in OpenSSL. Apple pushes a very old version of OpenSSL with Leopard. I spent an entire day looking at ways to compile the code to work for Leopard. The errors encountered were as follows:

1. Link error

collect2: ld returned 1 exit status
Waf: Leaving directory `/Users/harsharv/Downloads/nodejs
/node-v0.4.8/build'
Build failed:  -> task failed (err #1): 
	{task: cxx_link node_main_4.o,node_4.o,node_buffer_4.o,
node_javascript_4.o,node_extensions_4.o,node_http_parser_4.o,
node_net_4.o,node_io_watcher_4.o,node_constants_4.o,node_cares_4.o,
node_events_4.o,node_file_4.o,node_signal_watcher_4.o,
node_stat_watcher_4.o,node_timer_4.o,node_script_4.o,
node_os_4.o,node_dtrace_4.o,node_string_4.o,node_stdio_4.o,
node_child_process_4.o,platform_darwin_4.o,node_crypto_4.o,
eio_1.o,http_parser_2.o,ev_1.o,ares_strcasecmp_1.o,ares_free_string_1.o,
ares_options_1.o,ares_send_1.o,ares_parse_txt_reply_1.o,
ares_parse_ptr_reply_1.o,ares_nowarn_1.o,ares_search_1.o,
ares_gethostbyname_1.o,ares_getsock_1.o,ares__timeval_1.o,
inet_ntop_1.o,ares_parse_a_reply_1.o,ares_getopt_1.o,
ares__close_sockets_1.o,ares_expand_string_1.o,
ares_destroy_1.o,ares_cancel_1.o,
ares_parse_aaaa_reply_1.o,ares_parse_ns_reply_1.o,
ares_version_1.o,ares__get_hostent_1.o,ares_writev_1.o,
ares_expand_name_1.o,ares_free_hostent_1.o,
ares_parse_mx_reply_1.o,ares_gethostbyaddr_1.o,
ares_query_1.o,ares_data_1.o,ares_init_1.o,
ares_fds_1.o,inet_net_pton_1.o,ares_strerror_1.o,bitncmp_1.o,
ares_getnameinfo_1.o,ares_library_init_1.o,ares_mkquery_1.o,
ares_process_1.o,windows_port_1.o,ares_parse_srv_reply_1.o,
ares_llist_1.o,ares_timeout_1.o,ares__read_line_1.o,
ares_strdup_1.o -> node}
make: *** [program] Error 1

This problem is solved by upgrading OpenSSL.

2. You have managed to upgrade OpenSSL from 0.97 to 1.* and when you enter the command “node” you get the error

dyld: unknown required load command 0x80000022
Trace/BPT trap

The solution for this was very simple. Compile with out Open SSL 😀
Let me aggregate them. The steps are as follows:

  1. Download the latest source code from http://nodejs.org/#download. Example:http://nodejs.org/dist/node-v0.4.4.tar.gz
  2. tar -xzf node-v0.4.4.tar.gz
  3. cd node-v0.4.4
  4. ./configure –without-ssl
  5. make
  6. make install
  7. cd build/default/node
  8. node
Done

Advertisements
  1. August 22, 2011 at 7:16 am

    little change works for me

    Download the latest source code from http://nodejs.org/#download. Example:http://nodejs.org/dist/node-v0.4.4.tar.gz
    tar -xzf node-v0.4.4.tar.gz
    cd node-v0.4.4
    ./configure –without-ssl
    make
    sudo make install
    cd build/default/
    node

  2. August 22, 2011 at 8:27 am

    “sudo make install” is the change 😀 ?

  3. JimmyT
    September 6, 2011 at 7:54 pm

    Note that there are 2 ‘-‘ symbols as well. Like so:

    ./configure –without-ssl

  4. September 15, 2011 at 8:21 pm

    configure –without-ssl and –no-ssl2 still yielded the same error for me.

    ——————–

    After some hours googling found this solution
    (from: http://canonical.org/~kragen/compiling-node-on-macos.html)

    [download untar etc…]

    ISYSROOT=”-isysroot /Developer/SDKs/MacOSX10.5.sdk”
    export LINKFLAGS=$ISYSROOT CXXFLAGS=$ISYSROOT CFLAGS=$ISYSROOT
    ./configure –without-ssl –no-ssl2
    make

  5. matet
    January 22, 2012 at 8:44 am

    how to uninstall nodejs from mac?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: