sudo codesign --force --deep --sign - /path/to/executable
If you are trying to open an application or executable and it crashes immediately with a long error log, stops bouncing on the dock, or throws Killed 9, this command is for you!
sudo chmod -R 755 /path/to/folder
Whenever there are multiple files in a folder that you cannot modify, or if the folder itself has a red Not Permitted icon on it, this is the perfect command. For example, Finder cannot open the Desktop of another user on MacOS High Sierra, but if you run sudo chmod -R 755 /Users/another_user/Desktop then you can view everything on their Desktop. Its also needed when running an application with Shell Scripts, because newer MacOS versions prevent an app from accessing its own Resources! The -R stands for Recursively, which targets everything in a folder.
sudo chmod +x /path/to/executable
This command is very similar to chmod 755 but its designed for executables. Its super useful if you have a file that MacOS recognizes as a random, undefined piece of paper with a white icon, and you want to tell MacOS: Hold up, thats an executable! Run this command in Terminal on a specific file and it will immediately change the icon from a white paper to a black EXEC object. Like chmod 755, chmod +x also grants you permission to access the file. If you have a folder of executables to convert to EXEC, you can also place -R on this command for Recursively.
sudo xattr -rd com.apple.quarantine /Applications/MyApp.app/
Quarantine and Malware Detection were introducted to restrict apps from running on your computer if Apple does not agree with their intentions. For example, Apple does not support iCloud Bypassing or Downgrading to iOS 10.3.3, so obviously they dont want people opening Sliver or LeetDown. They attempt to hide this by saying the app is damaged and needs to go to the Trash, but in reality theres nothing wrong with the app. Every time that someone dismisses the Move To Trash popup with the checkbox ticked it sends a report to Apple so they can label the app as dangerous and stop people from using it. This is unfortunate for uninformed users who might actually believe the app is broken, because with this simple and easy Terminal command, you can free the app from quarantine and allow it to run!
/Applications/MyApp.app/Contents/MacOS/MyApp &
This trick is definitely one of my all time favorites. If you have an old MacOS version and find an application with the gray Not Permitted logo, type this command into Terminal to force-open the executable. For example, Apple stopped supporting iPhoto when they switched to Photos, so iPhoto became unlaunchable on High Sierra. This awesome command totally ignores any requirements and fires up the application anyways! It does not work on all apps or if the framework is incompatible, but its always worth a try. You can also use it to run apps in the Terminal to see error logs and output. If you want to run Sliver in the Terminal, use /Applications/Sliver.app/Contents/MacOS/Sliver &. Dont forget the ampersand!