In some flavors of Unix, you feel as if you've been cast into an alternate universe when you open a terminal window and work on the command line. But with OS X and its Darwin core, there's often an elegant integration between the two. In this how-to I'll show you how to launch an OS X app from the command line with the open command.
[Note: A little bit of prior UNIX experience will be helpful here.]
Mar 29, 2019 The sudo command lets you launch applications with root access, but it requires the path to the executable file within the application package. Most default Mac applications, as well as many third-party programs, organize the package contents the same way, so it's worth trying this: 3 X Research source. Sep 26, 2001 For the purposes of programming at the command-line level, Mac OS X is BSD Unix with a few extra nice bits added on (or complications, depending on your point of view). If you want to explore the exact details, go and try Darwin, which is the heavily customised BSD that Apple created to lay Mac OS X on top of. But most Unix tricks will work the. The Mac OS regularly reports obscure files as “unix executable” on the off chance that they don’t have a file extension or asset fork. In the event that that is the situation, you can open at that point by affixing the best possible file extension, for example “.doc” for MS Word archives. For app development, the nearest equivalent to Xcode would be Visual Studio. There is also a version of Visual Studio for Mac, if you ever feel the need to go back. For cross-platform source code editing (and a huge number of plug-ins) Visual Studio Code is the most popular choice.
First off, I will admit this technique is fairly geeky. In my [Mac] OS X career, I've only used this trick a handful of times. However, it's so darn cool and charming that one just aches to use it at any opportunity.
Actually, upon reflection, there are some useful scenarios for this technique.
Building Mac OS X App Bundles¶ Under Mac OS X, PyInstaller always builds a UNIX executable in dist. If you specify -onedir, the output is a folder named myscript containing supporting files and an executable named myscript. If you specify -onefile, the output is a single UNIX executable named myscript. Either executable can be started from a.
The Man Page
The terminal app is in the Utilities folder—which is found the Applications folder. Launch it now. The BSD UNIX command we'll be using is open. Below is the manual page ('man' for short), shown by typing:
I've printed most of the man page for the open command here for your perusal, but I'm not going to explore every argument. And feel free to jump right to the examples below to whet your appetite.
For this limited how-to, one interesting way to use the open command in this context is to use the [-a] option. Some other useful variations and arguments are in the examples below.
Typical Examples
Here are some short and sweet examples of the open command with the -a, -e, and -t arguments. They're easy to try. [If you don't have BBEdit installed, use any other favorite a text editor in /Applications.]
Open Doors
These are just a few of the cool things you can do on the command line with the open command. To keep things simple, I haven't delved into creating a search path or other Unix tricks like aliases. All that's been left for you to explore on your own.
I think this is one of the neatest tricks in OS X.
Unix Executable Mac
__________________
Launch button via Shutterstock.
-->
The following tips and control equivalents should help you in your transition between a Mac and Windows (or WSL/Linux) development environment.
For app development, the nearest equivalent to Xcode would be Visual Studio. There is also a version of Visual Studio for Mac, if you ever feel the need to go back. For cross-platform source code editing (and a huge number of plug-ins) Visual Studio Code is the most popular choice.
Keyboard shortcuts
Trackpad shortcuts
Note: Some of these shortcuts require a “Precision Trackpad”, such as the trackpad on Surface devices and some other third party laptops.
Note: Trackpad options are configurable on both platforms.
Terminal and Shell
Windows provides several alternatives to the Mac's terminal emulator.
The Windows command line will accept DOS commands, and is the most commonly used command line tool on Windows. To open it: Press WindowsKey+R to open the Run box, then type cmd and then click OK. To open an administrator command line, type cmd and then press Ctrl+Shift+Enter.
PowerShell is a 'PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems'. In other words, it's a very powerful command line, and is especially loved by system admins.
![]()
Incidentally, PowerShell is also available for Mac.
Run A Unix Executable File On A Mac
WSL allows you to run a Linux shell within Windows. This means you can run bash or other shell, depending on choice and the specific Linux distro installed. Using WSL will provide the kind of environment most familiar to Mac users. For example, you will ls to list the files in a current directory, not dir as you would with the Windows command line. To learn about installing and using WSL, see the Windows Subsystem for Linux Installation Guide for Windows 10.
Unix Executable Extension
Windows Terminal is an application that combines command-line tools and shells from a number of sources, including the traditional Windows Command Line, PowerShell, and Windows Subsystem for Linux. While it is currently still in preview, it already contains several useful features such as support for multiple tabs, split panes, custom themes and styles, and full Unicode support. Windows Terminal can be installed from the Microsoft Store on Windows 10.
Opening Unix Executable File MacApps and utilitiesRun Unix Executable On Mac
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |