How to move app bundles safely on the command line I need to copy/move a bunch of macOS apps from some directory locations to another location. I know I can do this safely via the Finder. (By "safely" I mean that the app still starts up and works after copying/moving.)

However I would like to do this via the command line. Can I just use cp and mv like this:

$ cp -pr /path/to/old-location/myapp.app /path/to/new-location

$ mv /path/to/old-location/myapp.app /path/to/new-location


What about resource forks of files in the bundle? Or do other considerations warranting a better command line tool for copying/moving apps safely?

I am using macOS 10.13, High Sierra, in this particular case, but of course I'd be interested in a solution independent of the macOS version.
The copying of files on the Mac command line is a curious thing. 

If both the source and the destination are on HFS, HFS+ or APFS file systems then cp will preserve special macOS attributes and since fairly early versions of macOS all extended attributes.

If you want to be slightly more secure you can use the -a option to cp which preserves absolutely everything including modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions.  Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved. It also copies, rather than follows, symbolic links. Personally, this is what I use for copying apps.

For a total guarantee, including copying to other file systems such as FAT or NTFS you should use ditto —-rsrc which saves all the neat stuff in .AppleDouble files on those file systems.

If you want more information I heartily recommend a close reading of the man page of both.

mv is safe as houses so long as you are on the same volume and fine if both source and destination volumes are macOS formats.

By the way, you mistyped your example. It should be cp -pR, which is essentially the same as cp -a.