Trouble following SQLite setup instructions

I’m trying to follow the instructions for setting up SQLite on Mac following the instructions on this page, and I have run into two different problems.

  1. On step 3 of the Mac OSX instructions, it says to enter this command into terminal from the sqlite folder:
    mv sqlite3 /usr/local/bin/
    This gave me an error saying I don’t have permission to rename the file. I guess it doesn’t /usr/local/bin/ as a valid file path?

  2. When the instructions above did not work, I tried to watch the video tutorial. The demonstrator does not follow the instructions but directly, seemingly skipping the aforementioned step. I was able to follow along fine until t=253 (4:13), where he says to type ‘.schema’. This command returns nothing for me.

So my questions are (1) how do I add sqlite3 to the terminal path following step 3 above and (2) why might .schema not reveal anything in my sqlite file?

On step 3 of the Mac OSX instructions, it says to enter this command into terminal from the sqlite folder:
mv sqlite3 /usr/local/bin/

This command works the following way, it will move the first argument to the second argument OR it will rename the first argument into the second.
I think the key part of this is “from the sqlite folder”. It sounds like you might not be in the sqlite folder. You can always type pwd to print your work directory and see where you currently are in the terminal.

Typing man mv explains the mv command:

In its first form, the mv utility renames the file
named by the source operand to the destination path
named by the target operand. This form is assumed
when the last operand does not name an already
existing directory.

 In its second form, mv moves each file named by a
 source operand to a destination file in the existing
 directory named by the directory operand.  The des-
 tination path for each operand is the pathname pro-
 duced by the concatenation of the last operand, a
 slash, and the final pathname component of the named

No, that’s not the issue. I am definitely in the correct folder. The issue seems to be that the bin folder is located in Macintosh HD, which is accessed with a forward slash. I can type cd / to navigate to that folder just fine, but mv doesn’t seem to recognize / as a directory, so it keeps trying to rename.

When I search Google for the problem, all the answers assume I’m trying to move a file to an external hard drive. No one seems interested in moving a file to the main Mac HD or its subdirectories.

We appear to be glossing completely over the fact that you are being presented with the following error:

It’s telling you that you don’t have permission to complete the operation.

I don’t use Mac, but a quick search suggests that SQLite ships along with the operating system these days. So, as a first guess, I wonder whether :

  1. The sqlite object is required by the system, and so it expects it to be in a specific directory and moving it is ill-advised; this would explain why you lack the permissions to complete the operation.


  1. The sqlite object is an OS-managed package, and is not allowing you to edit that file without being a superuser…

Either way, it would be interesting to know whether you can successfully copy the executable without issue. I would suggest trying:

cp sqlite /usr/local/bin

This assumes that you’re in the directory which contains the sqlite object.

1 Like

No, that’s not the issue
… “This gave me an error saying I don’t have permission to rename the file”

Yea but the thing is is that we have to take the error messages quite literally to get better clues. / is the root directory and /usr/local/bin/ is a system directory within the root, so they’re both going to be non-renameable.

You can type

$ whereis sqlite3
#if sqlite3 is in it's correct place it'll be here

Now if you want a foolproof way:

#make sure sqlite3 is in your dir
#copy your pwd
mv <paste_pwd>/sqlite3 <target_dir>

You can practice this by making 2 directories in far away places in your system.
Make sure you pwd their path and copy it, and test it out.


$ mkdir example1
$ mkdir example2
$ cd example1
$ touch testing
$ ls
# testing
$ pwd
# /Users/your_username/example1
$ mv /Users/your_username/example1/testing /Users/your_username/example2/
$ cd ..
$ ls example2
# testing

That’s a very good point!

Another good reason to run the whereis command to check whether you have something already installed (it’s good not to have a million duplicates of slightly different editions running around in your environment).


Thanks for the suggestion! The cp command returns ‘Permission denied.’ I’m going to try toastedpitabread’s pwd instructions below.

Thanks! I didn’t know about the whereis command. It indeed shows that sqlite3 is already installed in usr/bin (not usr/local/bin as the Codecademy instructions say), and I was able to proceed with the video tutorial after redownloading the database, which came up empty the first time.

I would like to say this is solved, but just for housekeeping I tried your instructions. They seem to work fine for a simple test, but not when going further up in the root directory.


$ cd example1
$ ls
# testing
$ pwd
# /Users/samjo/Desktop/example1
$ mv /Users/samjo/Desktop/example1/testing /Users/samjo/Desktop/example2/
$ cd ..
$ ls example2
# testing


$ cd sqlite-tools
$ ls
# sqldiff sqlite3 sqlite3_analyzer
$ pwd
# /Users/samjo/Desktop/sqlite-tools
$ mv /Users/samjo/Desktop/sqlite-tools/sqlite3 /usr/local/bin/
# mv: rename /Users/samjo/Desktop/sqlite-tools/sqlite3 to /usr/local/bin/sqlite3: Permission denied

I guess I just need to know how to change permissions?

Correct. But permissions are usually there for a reason, so it’s good to double-check the potential side-effects of anything you’re doing past permissions.

Usually you start something that requires extra permissions with the sudo command. I want to re-emphasize that this is a potentially dangerous tool. I recommend against copy and pasting a sudo command from a forum unless one is crystal clear about what each component of the command is doing.

Systems are inherently not uniform on many levels. I was installing some photoshop 2020 Google plugins for my mom through their own instructions and it was already slightly different from 2019 (but not updated) so I had to adjust accordingly.

Point is, it’s more important to try to figure out the structure of things than static instructions as you go along. There was a recent thread about a user looking for unix resources, you might find some useful links there: Looking for help with BASH


Excellent, the sudo command allowed me to move the file upon entering my password. I will keep the warnings in mind and look at the other thread. Thanks for all your help!