The System Photo Library is always in use when you are singed into your user account. Even if you have quitted the Photos app, there are likely still background processes like AMPLibraryAgent or photolibraryd accessing it.
So, if your System Photo Library is on the external hard drive, you'll have a hard time ejecting the disk.
The solution is to stop the processes from using your photos library. There are two ways to do it without force ejecting your disk:
① You can quit the background processes in Activity Monitor.
- Ensure that the Photos app is quitted.
- Open Terminal and run the following command to see the processes that are using your drive. (type lsof, leave a space, then drag and drop your disk partition into Terminal and hit Enter.)lsof /Volumes/drive_name
- Launch Activity Monitor, find these processes, right click on one and select Quit.
- Retry ejecting your drive after the processes are closed.
② You can create a new library and use it as the System Photo Library.
- Press and hold the Option key, then open Photos.
- Release the key after seeing the "Choose Library" window.
- Click "Create New" to generate a new, empty library folder.
- After Photos is open, click Photos > Preferences/Settings from the menu bar.
- In the General tab, click "Use as System Photo Library."
- Eject your external drive again.
The next time you want to open the photos library on your external drive in Photos, you can repeat step 1 and 2 to select it.
If you want to learn more ways to resolve the issue when you can't eject an external drive on Mac, read this guide: How to Safely/Force Eject External Hard Drive on Mac?