GNU Sed Problem

Thread Tools Search this Thread
Operating Systems OS X (Apple) GNU Sed Problem
# 1  
Old 08-28-2011
GNU Sed Problem

Hi, I'm and Android developer using Mac OSX 10.7. I use Dsixda's Android Kitchen to develop my roms. I had it working fine on 10.6.8 and it still worked flawlessly when updating to 10.7. I installed Macports, and installed some packages, and then tried to run the Android Kitchen. I CD'd to the folder and ran the ./menu command, and here is the response I get:

sed: illegal option -- -
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

Error: You do not have the correct version of 'sed' installed.
Refer to the FAQ for the HTC Android Kitchen at to ensure you have installed the GNU
version of sed.

I DO have GNU sed involved. I reinstalled OSX but it was no help. I also checked the FAQ with no help. If possible, I would like to avoid a full system wipe. Is there any way to fix this? It does work if I run a specific script, but it would be nice not to have to do that every time I want to.
# 2  
Old 08-28-2011
I hope you read the following FAQ:

3) Mac OS X
You need OS X 10.3 or higher on an Intel-based Mac (PPC-based systems will have problems)
You must create a .dmg disk image for your kitchen; otherwise the finished ROM will not boot.
Install the Sun Java JDK.
Install the GNU version of sed, as the default Mac OS X version (FreeBSD) of sed is not compatible with the kitchen. So DO NOT use the version of sed that comes with the OS X installer!
You might need to set your PATH variable to point to the folder containing the GNU version, otherwise your Mac may still be using the regular/non-GNU version of sed. Read here to set it automatically upon startup through the .bash_profile file. Note: The new sed path must be the FIRST entry in the PATH variable!
To verify you have the correct version, type sed --version. If this command works without error, and it mentions "GNU" in the output, then it should be good.
If the correct version still does not show up, even though you installed the GNU sed, then read this post for another solution.
If you still cannot manage to install the GNU version of sed, read this post which tells how to use Fink to install sed. Otherwise search Google!
Install gcc (C compiler) if you don't have it by default. Just type 'gcc' to verify you have it. It is included in the XcodeTools package on your installation DVD (more info found in Google).
Ensure you have wget installed. Otherwise, follow the instructions here to install it. Or maybe this way to install is easier


IT is at


Did you post the same question a couple of weeks ago? I remember the same question from 2 weeks ago.
# 3  
Old 09-06-2011
go to /etc paths and check your paths file and make sure your /usr/bin/ is available, and not /opt/local/macports/bin

macports also likes to place a path in your .profile Smilie
# 4  
Old 09-06-2011
These commands may help:
sed --version
which -a sed
type -a sed
echo $PATH

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

GNU sed running on Mac

Super basic question. I installed sed GNU on a MAC running High Sierra. However, when I run sed '1i>sometext, I get the following error: sed: 1: "1isometext"; command i expects \ followed by text I have added the \ with no success. Is there anyway I can run sed and awk on MAC in the... (5 Replies)
Discussion started by: Xterra
5 Replies

2. Shell Programming and Scripting

Sed, bash problems migrating from Cray to GNU/Linux

So, I have a series of ASCII files, all named something like mrkxxxxz.tmp (say, mrk1001z.tmp, mrk1002z.tmp, mrk1003z.tmp,...) -- these are .tmp files created by a large simulation program, and each different .tmp file represents a different parameter space used in the simulation). The simulations... (2 Replies)
Discussion started by: johnny_canucl
2 Replies

3. Shell Programming and Scripting

Insert @Line # - SED (non-GNU)

Just posted on another fellow's question using ed, but I wanted to know about doing it with sed on Unix. For example - I have a file of an unknown length, but I want to add a line after the shell declaration (Line 2). If possible, I'd like the example to be able to just substitute in a number and... (2 Replies)
Discussion started by: Vryali
2 Replies

4. Shell Programming and Scripting

Unexpected results with lists in GNU sed

I have been living with this problem with GNU sed v4.1.4 for a long time, but now I really need to figure it out. When using a list in either an address or a search, the expression is matching lower and upper-case letters. works as it should. For example, if I run sed -nr "// p"... (7 Replies)
Discussion started by: nctrader
7 Replies

5. UNIX for Dummies Questions & Answers

Is GNU sed installed?

Hi there, I'm new to UNIX and have the following question: At work a Solaris Unix system is used. I'm not sure if they have gnu sed installed so I tried using the command "sed -r" and got the error: "Illegal option --r" Does this mean that gnu sed is definitely not installed on the system... (8 Replies)
Discussion started by: js8765
8 Replies

6. UNIX and Linux Applications

GNU sed - Search and Replace problem

Hi, The following code loops through every file with an error extension and then loops through all XML files in that directory and replaces the target character @ with / . The problem I have is that if there is more than one occurance of @ in each individual file it doesn't replace it. Any... (2 Replies)
Discussion started by: Fishn
2 Replies

7. Shell Programming and Scripting

gnu sed replace space with new line

please help in making sed singleline command i need to insert dos new line (CR LF) before " 34 matching device(s) found on \\cpu1." " 6 matching device(s) found on \\cpu7." " 102 matching device(s) found on \\mainserver." the problem is that sometimes there are both CR LF before strings and... (1 Reply)
Discussion started by: xserg
1 Replies

8. Programming

Dependencies problem GNU automake

I am using the GNU automake. I have created the and files but don't know how to link in my dependencies. I have basically added another project (OpenCV) to my eclipse workspace and want to reference this in the build. I have set Eclipse up to include the Cpp files... (5 Replies)
Discussion started by: hembergb
5 Replies

9. Shell Programming and Scripting

gnu sed regex grouping not working?

Hello, from the gnu sed manual, I should be able to do this: `\(REGEXP\)' Groups the inner REGEXP as a whole, this is used to: * Apply postfix operators, like `\(abcd\)*': this will search for zero or more whole sequences of `abcd', while `abcd*' ... (3 Replies)
Discussion started by: Allasso
3 Replies

10. Programming

GNU GDB compile problem

I have to compile gnu-gdb 6.7 on HP-UX 11.11 with /usr/local/pa64/bin/gcc 64-bit compiler, but I'm having some problems during "make": ser-tcp.c: In function `net_open': ser-tcp.c:207: warning: passing arg 5 of `getsockopt' from incompatible pointer type make: *** Error 1 make: Leaving... (8 Replies)
Discussion started by: untamed
8 Replies
Login or Register to Ask a Question