While trying to further my knowledge in unix/shell programming I’ve found that the unix command sed is messed up in os x. I think the problem is that the GNU/linux versions of some commands are different that the Darwin/BSD versions, this might be obvious to you linux/unix gurus out there but to me this is new news. I always assumed that the functionality in the commands on os x and most linux variants were the same.

In any case, I downloaded the GNU sed source code and compiled a nice fixed sed command for myself (After I compiled it I found out you could of just easily gotten GNU sed through fink-commander. :P ). Walla, the newline problem I was having with the mac os x version of sed was fixed.

Average Rating: 4.5 out of 5 based on 295 user reviews.

2 Responses to “”

  • Hi,

    I’m using sed to transform XML, and ran into what I think is the same problem, that sed doesn’t see \n as a newline in Mac OSX.

    My question is (I’m a newbie) how do you download and compite the GNU source code?


  • You can compile GNU sed by downloading the source, unpacking the source archive, then executing the following commands in the terminal assuming all the sed source code in a “sed-source” directory on the desktop:

    cd ~/Desktop/sed-source
    mkdir sed
    ./configure –prefix=~/sed && make && make install

    sed will be located in the bin folder inside a sed folder on your desktop.
    Email/AIM me if you need more help.

Leave a Reply