1 | launch 1.0a9 [2 April 2002]
|
---|
2 | ============
|
---|
3 |
|
---|
4 | A command-line launcher for Mac OS X in the spirit of open(1).
|
---|
5 |
|
---|
6 | Written by Nicholas Riley <mailto:launchsw@sabi.net>.
|
---|
7 | Obtain updates from <http://web.sabi.net/nriley/software/>.
|
---|
8 |
|
---|
9 | WHAT IS IT?
|
---|
10 | -----------
|
---|
11 |
|
---|
12 | Apple provides a simple command-line launching program called 'open'
|
---|
13 | with Mac OS X. It offers few options - launching applications by name
|
---|
14 | or by path, launching TextEdit, or opening a number of applications,
|
---|
15 | documents, folders, etc. With the exception of special support for
|
---|
16 | TextEdit, 'launch' does all this and:
|
---|
17 |
|
---|
18 | - opens URLs, directly or in your preferred helper application (-l)
|
---|
19 | - lets you specify applications by their four-character creator
|
---|
20 | (e.g. 'ToyS') or Java-style bundle ID (e.g. com.apple.scripteditor),
|
---|
21 | both of which allow you to move or rename an application without
|
---|
22 | changing references to it
|
---|
23 | - asks applications to print documents, something the OS X Finder
|
---|
24 | no longer permits
|
---|
25 | - launches applications in the background
|
---|
26 | - launches Carbon applications in Classic
|
---|
27 | - displays file information including type, creator, bundle ID,
|
---|
28 | data and resource fork sizes, and dates
|
---|
29 | - reports errors intelligibly
|
---|
30 | - and much more!
|
---|
31 |
|
---|
32 | 'launch' is useful by itself, but is even better when used in scripts.
|
---|
33 | Assign a shell command to your favorite Mac OS text, graphics or
|
---|
34 | resource editor. Go to your favorite Web site with a few keystrokes.
|
---|
35 |
|
---|
36 | Like 'open', 'launch' provides one half of the round-trip between
|
---|
37 | Terminal.app and the Finder. You can drag and drop icons or proxy icons
|
---|
38 | into Terminal.app to insert their paths into command lines. To go in the
|
---|
39 | other direction, just type 'launch .' (or 'open .') to open a Finder window
|
---|
40 | showing the current directory.
|
---|
41 |
|
---|
42 | INSTALLATION
|
---|
43 | ------------
|
---|
44 |
|
---|
45 | The commands below install the 'launch' tool in /usr/local/bin, which
|
---|
46 | is in the default path. You should subsequently be able to use
|
---|
47 | 'launch' by typing its name. If you wish to install it somewhere else,
|
---|
48 | modify the install line as appropriate.
|
---|
49 |
|
---|
50 | % sudo /usr/bin/install -c build/launch /usr/local/bin
|
---|
51 | % rehash
|
---|
52 |
|
---|
53 | Uninstallation:
|
---|
54 |
|
---|
55 | % sudo rm -f /usr/local/bin/launch
|
---|
56 |
|
---|
57 | COMPILATION
|
---|
58 | -----------
|
---|
59 |
|
---|
60 | A Project Builder project, 'launch.pbproj', is included. A
|
---|
61 | precompiled binary is also provided. 'launch' was developed and
|
---|
62 | tested under Mac OS 10.1 and 10.1.1 with the 10.1 Developer Tools, and
|
---|
63 | does not require any additional software to build.
|
---|
64 |
|
---|
65 | USAGE
|
---|
66 | -----
|
---|
67 |
|
---|
68 | Just type 'launch' by itself to receive usage information.
|
---|
69 |
|
---|
70 | Some examples:
|
---|
71 |
|
---|
72 | % launch -ni com.apple.iTunes
|
---|
73 | /Applications/iTunes.app
|
---|
74 | [hint, hint]
|
---|
75 |
|
---|
76 | % launch -c 'R*ch'
|
---|
77 | [BBEdit opens]
|
---|
78 |
|
---|
79 | % launch -pbc 'R*ch' test.txt
|
---|
80 | [BBEdit starts printing test.txt in the background]
|
---|
81 |
|
---|
82 | % launch -l http://www.apple.com/
|
---|
83 | [Your preferred Web browser opens Apple's Web site]
|
---|
84 |
|
---|
85 | /Applications/Preview.app: Mac OS X application package
|
---|
86 | type: 'APPL' creator: 'prvw'
|
---|
87 | bundle ID: com.apple.Preview
|
---|
88 | kind: Application
|
---|
89 | contents: 2 items
|
---|
90 | [...]
|
---|
91 |
|
---|
92 | FREQUENTLY ASKED QUESTIONS
|
---|
93 | --------------------------
|
---|
94 |
|
---|
95 | Q. How do I discover bundle IDs for applications?
|
---|
96 |
|
---|
97 | A. The -f option to launch can help. Say you have OmniWeb in the
|
---|
98 | /Applications/Internet folder, and want to find out its bundle ID.
|
---|
99 | Type 'launch -f', and drop the OmniWeb icon on Terminal:
|
---|
100 |
|
---|
101 | % launch -f /Applications/Internet/OmniWeb.app
|
---|
102 | /Applications/Internet/OmniWeb.app: Mac OS X application package
|
---|
103 | type: 'APPL' creator: 'OWEB'
|
---|
104 | bundle ID: com.omnigroup.OmniWeb
|
---|
105 | kind: Application
|
---|
106 |
|
---|
107 | Note that bundle IDs are not case-sensitive: com.barebones.BBEdit is
|
---|
108 | the same as com.barebones.bbedit.
|
---|
109 |
|
---|
110 |
|
---|
111 | Q. Why can't I use -f with -c to get info on an application with a
|
---|
112 | given creator?
|
---|
113 |
|
---|
114 | A. This feature may be added to a later version (or add it yourself!),
|
---|
115 | but there is a workaround. Instead of:
|
---|
116 |
|
---|
117 | % launch -f -c 'Doug'
|
---|
118 | launch: can't get information (-f) on item(s) using an application (-u, -c, -i, -a)
|
---|
119 |
|
---|
120 | use:
|
---|
121 |
|
---|
122 | % launch -f "`launch -nc 'Doug'`"
|
---|
123 | /Volumes/GrayApps/Utilities/Resorcerer 2.4/Resorcerer: scriptable Mac OS X application [Carbon, prefers native OS X]
|
---|
124 | type: 'APPL' creator: 'Doug'
|
---|
125 | kind: Application
|
---|
126 |
|
---|
127 |
|
---|
128 | Q. Why do bundle IDs not work for non-packaged applications?
|
---|
129 |
|
---|
130 | A. I think this is a LaunchServices/CFBundle bug. For example, BBEdit
|
---|
131 | 6.1 for OS X was a packaged application; BBEdit 6.5 is not, however its
|
---|
132 | 'plst' resource contains a bundle ID. LaunchServices is unable to
|
---|
133 | locate BBEdit 6.5 by its bundle ID.
|
---|
134 |
|
---|
135 | Non-packaged applications usually come from older Mac OS applications,
|
---|
136 | so they will have creators, which is a workaround (use -c instead of
|
---|
137 | -i).
|
---|
138 |
|
---|
139 |
|
---|
140 | Q. Why doesn't launch support opening items as root?
|
---|
141 |
|
---|
142 | A. Apple eliminated this capability with the Mac OS X 10.1 Security
|
---|
143 | Update. If at some point Apple restores this capability, 'launch'
|
---|
144 | will be ready to support it.
|
---|
145 |
|
---|
146 |
|
---|
147 | Q. Why do I get an error -600?
|
---|
148 |
|
---|
149 | A. A typical occurrence of this would be:
|
---|
150 |
|
---|
151 | % launch -n .
|
---|
152 | launch: can't open items: unable to connect to system service.
|
---|
153 | Are you logged in? (-600)
|
---|
154 |
|
---|
155 | In order to perform certain operations, launch needs to talk to
|
---|
156 | various system services owned by the currently logged-on user. If you
|
---|
157 | aren't using 'launch' from a terminal currently logged into the Mac OS
|
---|
158 | X GUI, certain operations may not work. Try opening Terminal.app,
|
---|
159 | creating a new terminal, and trying again.
|
---|
160 |
|
---|
161 | Another possibility is to create your own interprocess messaging.
|
---|
162 | For example, place this script in a file:
|
---|
163 |
|
---|
164 | #!/bin/sh
|
---|
165 | PIPE=/tmp/.launchpipe
|
---|
166 | [ -e $PIPE ] || mkfifo $PIPE
|
---|
167 | while true; do
|
---|
168 | read opts < $PIPE
|
---|
169 | eval "/path/to/launch $opts" & # change this to launch's path
|
---|
170 | done
|
---|
171 |
|
---|
172 | Then, define a function or alias. For zsh:
|
---|
173 |
|
---|
174 | rlaunch() { echo $@ > /tmp/.launchpipe }
|
---|
175 |
|
---|
176 | Or for tcsh:
|
---|
177 |
|
---|
178 | alias rlaunch 'echo \!* > /tmp/.launchpipe'
|
---|
179 |
|
---|
180 | Start the shell script above from the console, then you can use
|
---|
181 | 'rlaunch' in place of 'launch' logged in from anywhere else.
|
---|
182 |
|
---|
183 | Thanks to robert <robert@allyourbass.org> for this suggestion.
|
---|
184 |
|
---|
185 | COMMENTS, SUGGESTIONS, BUG REPORTS, ETC.
|
---|
186 | ----------------------------------------
|
---|
187 |
|
---|
188 | Please send to the author, Nicholas Riley, at <launchsw@sabi.net>.
|
---|
189 |
|
---|
190 | VERSION HISTORY
|
---|
191 | ---------------
|
---|
192 |
|
---|
193 | 1.0a9 - 2 April 2002 - license, comments changes
|
---|
194 | 1.0a8 - 29 March 2002 - errors with -l (from ICeCoffEE), added rlaunch script
|
---|
195 | 1.0a7 - 3 March 2002 - print dates, sizes, folder valence, locked status for -f,
|
---|
196 | don't abort on failure to obtain bundle information
|
---|
197 | 1.0a6 - 30 November 2001 - fixed incorrect messages, broken -u and crash on -nu
|
---|
198 | 1.0a5 - 28 November 2001 - print kind string for -f, still no new installer
|
---|
199 | 1.0a4 - 20 November 2001 - [try to] use Installer VISE instead of InstallAnywhere
|
---|
200 | 1.0a3 - 15 November 2001 - fixed package identification in -f, updated examples
|
---|
201 | 1.0a2 - 15 November 2001 - -f, removed broken -m
|
---|
202 | 1.0a1 - 14 November 2001 - renamed from "FindApp", launch by default, -u
|
---|
203 | 1.0d5 - 7 November 2001 - option -s for launching as root [nonfunctional]
|
---|
204 | 1.0d4 - 6 November 2001 - URL launching and Internet Config support
|
---|
205 | 1.0d3 - 4 November 2001 - more robust, support for docs without app
|
---|
206 | 1.0d2 - 4 November 2001 - options -opsbmhCX, -cin, documents
|
---|
207 | 1.0d1 - 26 August 2001 - returns path of application identified by creator
|
---|