Showing posts with label OSX. Show all posts
Showing posts with label OSX. Show all posts

Friday, March 1, 2013

Discover how much memory is installed in OSX from the terminal

Today I was sitting SSHed into an OSX box and needed to know how much RAM was physically installed in the machine. Top of course told me how much RAM was in use however finding the installed RAM took me a few minutes longer than I would have liked.

So this is a note to myself for next time, use the following:

trastle$ system_profiler |  grep -A 9 "BANK [0-9]/DIMM[0-9]"
        BANK 0/DIMM0:

          Size: 2 GB
          Type: DDR3
          Speed: 1333 MHz
          Status: OK
          Manufacturer: 0x80AD
          Part Number: 0x484D54333235533642465238432D48392020
          Serial Number: 0xDEADBEEF

        BANK 1/DIMM0:

          Size: 2 GB
          Type: DDR3
          Speed: 1333 MHz
          Status: OK
          Manufacturer: 0x80AD
          Part Number: 0x484D54333235533642465238432D48392020
          Serial Number: 0xDEADBEEF

Have fun!

Saturday, March 20, 2010

Building XMLStarlet in Snow Leopard (OSX 10.6)

XMLStarlet is a command line XML toolkit. Very useful if you want to parse some data from a webpage, RSS feed of similar. XMLStarlet does not provide a binary version for Snow Leopard. They do however provide their source under the MIT licence. So your free to download, build and modify.

To get XMLStarlet up and running on Snow Leopard is nice and easy.

  1. Install Xcode with the Unix the Unix Dev Support Option (see my past post about building wget for more details on this).

  2. Go download yourself a copy of the XMLStarlet source (I am using v 1.0.1).

  3. XMLStarlet requires libxml2 and libxslt. Snow Leopard ships with both these libraries installed, however they are not in the location expected by the XMLStarlet build script so some symlinks are required. Enter the following in a terminal:
    sudo ln -s /usr/lib/libxslt.1.dylib /usr/lib/libxslt.a
    sudo ln -s /usr/lib/libexslt.dylib /usr/lib/libexslt.a
    sudo ln -s /usr/lib/libxml2.dylib /usr/lib/libxml2.a
    
    
  4. Unpack the XMLStarlet tarball by double clicking it in Finder.
    Take note of the name of the newly unpacked directory (something like xmlstarlet-1.0.1).

  5. Open a terminal and cd to where you just unpacked (by default this will be the directory below).
    cd ~/Downloads/xmlstarlet-1*
    
    
  6. Run the configure script:
    ./configure
    
    
  7. Run the builds
    make
    
    
  8. Run the installer:
    sudo make install
    
    
  9. Finally, to test that the install worked correctly enter the following in a terminal:
    TA:~ troy$ xml 
    XMLStarlet Toolkit: Command line utilities for XML
    ... 
    XMLStarlet is a command line toolkit to query/edit/check/transform XML documents 
    (for more information see http://xmlstar.sourceforge.net/)
    
    
Enjoy.

Wednesday, October 28, 2009

Building wget in Snow Leopard

I like Snow Leopard, it's a nifty OS, but occasionally something will baffle me. This evening it was the exclusion of wget from the command line tools.



Clearly this sucks and living without wget is not an option. Thankfully wget is free software so it's easy to grab the source and build it yourself.

Firstly you'll need to have Xcode installed with "Unix Dev Support". The Unix Dev Support option gives you gcc, make and other essential goodies. Xcode is on the Mac OS 10.6 DVD in the optional installs section (you can also download Xcode from Apple).

Next you'll need to grab the latest wget source from: ftp://ftp.gnu.org/pub/gnu/wget/ or click here.

To compile and install wget complete the following:

  1. Unpack the wget tarball by double clicking it in Finder.
    Take note of the name of the newly unpacked directory (something like wget-1.12).
     
  2. Open a terminal and cd to where you just unpacked (by default this will be the directory below).
    cd ~/Downloads/wget-1.*
     
  3. Run the configure script:
    ./configure
     
  4. Run the build and installer:
    sudo make install
     
  5. All done. Now you can delete the wget folder and tarball in your ~/Downloads directory. 

Once your done you'll be able to run wget in your terminal.



Much better.