LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.

Notices


Reply
  Search this Thread
Old 10-19-2008, 03:19 PM   #1
Pinball2k
LQ Newbie
 
Registered: Oct 2008
Location: San Francisco
Distribution: OSX
Posts: 3

Rep: Reputation: 0
Newbie - OSX "command not found" Path issue


I know very little about UNIX but have what I think is a simple question.

When using the Terminal program under Apple OSX I get a "command not found" error.

Here's what I'm doing.
1.Opening the Terminal application
2 Changing directories into \Appliactions\sqlite
3 Trying to run the "sqlite" application by typing "sqlite" without the quotes.

This what I see.

172:/Applications/sqlite fwi$ sqlite
-bash: sqlite: command not found
172:/Applications/sqlite fwi$

I do a directory command and can see the application.

172:/Applications/sqlite fwi$ ls -l
total 2344
-rw-r--r-- 1 fwinogra admin 53965 Aug 10 2005 SQLite ReadMe.pdf
drwx------ 37 fwinogra admin 1258 Oct 18 11:23 capi
drwx------ 35 fwinogra admin 1190 Oct 18 11:23 capi_ext
drwx------ 28 fwinogra admin 952 Oct 18 16:11 common
-rwx------ 1 fwinogra admin 34816 Apr 3 2006 foods.db
-rwx------ 1 fwinogra admin 55943 Mar 3 2006 foods.sql
drwx------ 22 fwinogra admin 748 Oct 18 11:23 java
-rw-r--r-- 1 fwinogra admin 575200 Aug 10 2005 libsqlite.a
drwx------ 10 fwinogra admin 340 Oct 18 11:23 perl
drwx------ 9 fwinogra admin 306 Oct 18 11:23 python
drwx------ 7 fwinogra admin 238 Oct 18 11:23 ruby
-rwx------ 1 fwinogra admin 16720 May 21 2006 sql.sql
-rwxr-xr-x 1 fwinogra admin 408728 Aug 10 2005 sqlite
-rw-r--r-- 1 fwinogra admin 38778 Aug 10 2005 sqlite.h
drwx------ 3 fwinogra admin 102 Oct 18 11:23 tcl


4 If I type in as follows, this is what I see.

172:/Applications/sqlite fwin$ /Applications/sqlite/sqlite
SQLite version 2.8.16
Enter ".help" for instructions
sqlite>
It works just fine!!!

5 Any suggestions?
 
Old 10-19-2008, 03:21 PM   #2
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
run ./sqlite
 
Old 10-19-2008, 03:22 PM   #3
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by Pinball2k View Post
5 Any suggestions?
Add the directory containing the executable to your PATH environment variable. I don't know which shell OS X uses by default, but if it's bash(-compatible), then you'll want to do

export PATH=$PATH:/path/to/sqlite,

obviously replacing "/path/to/sqlite" with the relevant directory. You'll probably want to add that line to your .bashrc or .bash_profile in your home directory, too.
 
Old 10-19-2008, 03:23 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 404Reputation: 404Reputation: 404Reputation: 404Reputation: 404
I have no idea about OSX.

However, the problem seems to be that /Applications/sqlite/ is not in your $PATH, that's why you need to specify the whole path. You can also do it relative. For example, if you are into /Applications/sqlite/ already, you could do ./sqlite. It should work, but, as said, I know nothing about OSX.
 
Old 10-19-2008, 03:25 PM   #5
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
add /Applications/sqlite in your PATH...
Code:
echo 'export PATH=/Applications/sqlite:${PATH}' >> ~/.bashrc
Then, just open a new terminal window and type: sqlite

[edit]
As previous posters said
 
Old 10-19-2008, 03:47 PM   #6
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
Mac OS X is not a Linux based operating system.
 
Old 10-19-2008, 03:49 PM   #7
Pinball2k
LQ Newbie
 
Registered: Oct 2008
Location: San Francisco
Distribution: OSX
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by i92guboj View Post
I have no idea about OSX.

However, the problem seems to be that /Applications/sqlite/ is not in your $PATH, that's why you need to specify the whole path. You can also do it relative. For example, if you are into /Applications/sqlite/ already, you could do ./sqlite. It should work, but, as said, I know nothing about OSX.
Yes, this did work, thanks. But I thought it would look in the current directory first. I guess not?
 
Old 10-19-2008, 03:53 PM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 404Reputation: 404Reputation: 404Reputation: 404Reputation: 404
It's based on a Mach microkernel and derived from BSD, which is a unix clone, but yeah, definitely it's not linux.

So, maybe this would be better if modev into the Other *nix subforum:
http://www.linuxquestions.org/questions/other-nix-55/
 
Old 10-19-2008, 03:55 PM   #9
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
On OSX 10.3, each user has a ~/.bashrc by default with content:
Code:
alias ls="ls -G"
PATH=$PATH:$HOME/bin
export PATH
export TERM=xterm-color
I don't know your OSX version...
If you want the current directory in your PATH, you have to add '.', but it is considered as a security issue
 
Old 10-19-2008, 03:55 PM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 404Reputation: 404Reputation: 404Reputation: 404Reputation: 404
Quote:
Originally Posted by Pinball2k View Post
Yes, this did work, thanks. But I thought it would look in the current directory first. I guess not?
No. Unlike in other OSes, linux doesn't include the current dir in the PATH by default, it's done that way as a security measure. Some malicious user could use that to harm your system or scale privileges. For example, imagine what could happen if someone send you a harmful script called "ls" and you run it by accident when you really meant to use the command "ls".

You could add it to the PATH, by adding a "." (dot) to the PATH variable, however I advice against that.
 
Old 10-19-2008, 03:58 PM   #11
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Moved: This thread is more suitable in Other *NIX and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 10-19-2008, 04:00 PM   #12
Pinball2k
LQ Newbie
 
Registered: Oct 2008
Location: San Francisco
Distribution: OSX
Posts: 3

Original Poster
Rep: Reputation: 0
You could add it to the PATH, by adding a "." (dot) to the PATH variable, however I advice against that.[/QUOTE]

This makes a lot of sense, much thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LFS6.3 livecd "ls : command not found" error after "su - lfs" rotu Linux From Scratch 2 06-19-2008 03:59 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
SAMBA Configuration Issue: "Network path was not found" on client gerhardbartsch Linux - Networking 4 04-03-2007 02:40 PM
Newbie problem: Starting YAST gives me "-bash: yast: command not found". cattleya Linux - Software 9 11-20-2003 11:18 AM
Samba & Win2K pro, "network path not found" RedHat123 Linux - Networking 8 02-05-2002 09:57 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX

All times are GMT -5. The time now is 11:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration