Learn Courses My Dashboard

Run a terminal command from other than its usual directory

Hi. I’m learning to use the terminal, and am wondering if anyone would know how to run the /bin/mv command but from outside of its usual location. I’d like to make a copy of mv, put it in a different location and then run the copy from that location, called from a script. I’ve put the new location at the beginning of the PATH, so terminal finds it alright, but it just kills the process when the script calls it.

yeah so like you want to move a file from one location to the other?

Here’s a link to start: Manage files in Terminal on Mac - Apple Support.

I want to run the command itself from a different directory. It resides in root/bin/ I want to move it to Desktop and have it run from there, but it runs into code signing issues after having copied it over, so terminal will shut it down. It gives this error:

CODESIGNING 4 Launch Constraint Violation

I think it is because the permissions have changed when it is copied. The permissions change from root/system/wheel, or something like that, to homedirectory/users/groups.

So I personally tried this myself. I did cp /bin/mv to my desktop. it gives me a Kill: 9 error when doing it myself.

Yes, I’m just curious about it really. I run Bitdefender on my Mac. My Desktop is monitored by it so that any program (unless it is added to an exceptions list) that tries to mess with Desktop files is blocked. A popup alerts you and asks if you want to allow it to run. I’m learning how to use the terminal and write scripts, so I’ve written a simple script that cleans up my Desktop when it gets cluttered, but I get a Bitdefender alert when it tries to run the mv command. I can add mv to the exceptions list, and that stops the popup, but, in theory, it would also allow any potential hacker to use it to. I had the idea that if I ran it from the Desktop that I could add it to the Bitdefender exceptions list while still blocking it globally. It obviously isn’t that simple.

1 Like