Use Terminal To Move Photo Library

  

Prepare your external drive

  1. Use Terminal To Move Photo Library From Desktop To Dock
  2. Use Terminal To Move Photo Library Location Mac

Back up your Photos library automatically. If you've turned on the Download Originals option for your Photos library, you can back up your Photos library as part of your regular backup routine with Time Machine or even an online clone service like Carbon Copy or BackBlaze. No matter which method you prefer (though it's highly recommended to use. Start up with macOS Recovery and use Disk Utility to repair the drive. You can also use the Terminal command lsof, which tracks all files in use by even the lowest of low-level parts of the system.

You can store your library on an external storage device, such as a USB or Thunderbolt drive formatted as APFS or Mac OS Extended (Journaled). However, you can't move your library to a disk that's used for Time Machine backups.

To prevent data loss, Apple doesn't recommend storing photo libraries on external storage devices like SD cards and USB flash drives, or drives that are shared on a network.

Move your Photos library to an external storage device

  1. Quit Photos.
  2. In the Finder, go to the external drive where you want to store your library.
  3. In another Finder window, find your Photos Library. By default it's stored in the Pictures folder located at /Users/[username]/Pictures.
  4. Drag Photos Library to its new location on the external drive. If you see an error, select your external drive's icon in the Finder, then choose File > Get Info. If the information under Sharing & Permissions isn't visible, click the triangle , then make sure the 'Ignore ownership on this volume' checkbox is selected. If it's not selected, click the lock button to unlock it, enter an administrator name and password, then select the checkbox.*
  5. After the move is finished, double-click Photos Library in its new location to open it.
  6. If you use iCloud Photo Library, designate this library as the System Photo Library.

Make sure that the drive is turned on and available to your Mac before opening Photos. If Photos can't find your drive, it stops using the Photos Library stored there.

Delete original library to save space

After you open your library from its new location and make sure that it works as expected, you can delete the library from its original location.

Use Terminal To Move Photo Library From Desktop To Dock

In a Finder window, go back to your Pictures folder (or whichever folder you copied your library from) and move Photos Library to the trash. Then choose Finder > Empty Trash to delete the library and reclaim disk space.

Use terminal to move photo library software

Open another Photos library

If you have multiple libraries, here's how to open a different one:

  1. Quit Photos.
  2. Press and hold the Option key while you open Photos.
  3. Select the library that you want to open, then click Choose Library.

Photos uses this library until you open a different one.

Learn more

If you have a permissions issue with your library, you might be able to resolve the issue by using the Photos library repair tool.

* If the volume isn't formatted as APFS or Mac OS Extended (Journaled), or has been used for Time Machine backups but hasn't been erased, this checkbox will either not be present, or it won't be selectable after unlocking. Erase the drive for this option to be available.

At this point in the course, you can:

  • see where you are in your system (pwd)

  • list the contents of a directory (ls)

  • change directories (cd)

  • make directories (mkdir)

  • make files (touch file-name.extension)

  • use keyboard shortcuts to avoid command line typing hassles

Now, you might want to move around or copy content that you've created. There are a series of commands that will allow you to do this.

Move content

Let's say you've accidentally created a file in the wrong place, like putting your biology research spreadsheet in your art history folder. 😖

If you use a visual interface like Finder (or another visual interface), you would have to click and drag this file into its correct location. In Terminal, you don't have a visual interface, so you'll have to know the mvcommand to do this!

mv , of course stands for move. The mv command requires several pieces of information.

  • the original file we want to move.

  • the new destination for the original file.

My first piece of information is therefore research-findings.csv , and my second piece of information is therefore the file path to the Biology folder.

Absolute and relative file paths

I could type this in two different ways. Let's explore the difference between absolute and relative file paths.

Option 1 (absolute path):

Option 2 (relative path):

Option 1 contains the absolute path towards the Biology folder. Each folder is listed in the path from top to bottom.

Option 2 is a relative path . It is the path relative to where we are now. .. indicates 'move up one level' (to 'Second semester'), and from there, move into the Biology folder.

Rename content using mv

You can also rename files and folders using the mv command. To rename research-findings.csv to biology-final-report.csv , you could run:

Technically, you're 'moving' the one file to another and renaming it in the process. 👍

You can also use mv with folders in order to move them! It's not just for files.

Copying files

Copying content works similarly to moving content. Let's start with copying a file because it's simpler.

The same arguments are true for cp (copy) as for mv (move):

  • The first argument is the original file we want to move.

  • The second argument is the new destination for the copy of the original file.

Let's run through an exercise to put together a few different things we've worked on.

Watch the chapter video for an easier-to-understand demo! It's hard to process these concepts, and seeing the video will help a lot.

Scenario: you want to copy the final coursework from your second semester folder to a new folder called 'Final papers'. You don't want to move the files; just copy them to a different folder so you can have copies of your final papers in one centralized place.

From within 'Second semester' folder, make a directory to contain the end of semester work.

Now, you can either change directories (cd) into the Art history folder and copy the final paper from there, or just copy it without changing directories.

or

Now change directories (cd) into the Final papers folder and list its contents (ls) to confirm the file is now copied here:

Brilliant!

Optional study: copying folders

Copying folders is more tricky. You will need to use something called an option. Options exist for many terminal commands. They are a way for you to tell the computer that a command should run in a specific, non-default way.

To copy folders, you'll use the recursive option. Recursive is similar to iteration, in that the command will run in small increments in order to achieve its final goal. This is not worth worrying about right now, though you can read more about recursiveness here.

Use terminal to move photo library software

Use Terminal To Move Photo Library Location Mac

For this example, we'll hop back to our code project. I want to duplicate my code folder in order to use the code I've written as a base for another project. The original directory is called code-project, so I'll name my copy code-project-2.

Use Terminal To Move Photo Library

To copy this folder from one place to another, you'll run:

This copied my code-project folder (including its contents) into a new folder called code-project-2. The -R is an option that specifies you want the command to run with recursion.

Now you can move and copy files and folders. Nice! In the next chapter, you'll see how to search for content among all the folders and files you've created in this course so far.