Controlling from the command line

nlvp

Registered
Perhaps I'm being dense, and I'd love to be set straight on this, but there seems to be a rather strict segregation of functionality between the CLI and the desktop.

I can find no way of accessing many of the most basic programs from the command line - for example, the mail functionality on the command line is the standard *NIX mail program, or whatever you've installed, but there's no way of interacting with your OSX Mail stored via the Mac Mail program from the command line. Similarly, the calendar is completely inaccessible from the CLI - you need to interact with the desktop to do anything with the calendar.

It's almost like you're using a different computer, so separated are the two environments.

I use VNC to connect to the computer graphically, but sometimes don't want to leave it logged in at home, so I leave it on the login screen. Unfortunately, this means that VNC can't connect until someone's logged in at home...

Is there a way to log in the local user somehow from a remote SSH? Alternatively, are there ways of interacting with certain functionalities usually reserved for desktop applications from the command line?

Is there an OSX-specific manual for the command line that I can use? I'm familiar with Unix, but not when it comes to the Mac-specific functionality...

Thanks,

Nic.
 
There's a decent book called "Learning UNIX for Mac OS X Tiger" by Dave Taylor: http://www.amazon.com/Learning-Unix-Mac-OS-Tiger/dp/0596009151/sr=8-1/qid=1160149839/ref=pd_bbs_1/102-4195311-8524961?ie=UTF8&s=books. It's more of a beginning UNIX book for die-hard Mac users.

There's also a book by Brian Jepson called "Mac OS X Tiger for UNIX Geeks" which might be more of what you're looking for. http://www.amazon.com/Mac-OS-Tiger-Unix-Geeks/dp/0596009127/ref=pd_bxgy_b_text_b/102-4195311-8524961?ie=UTF8

I've bought both of these books at Borders / Barnes & Noble.
 
Perhaps I'm being dense, and I'd love to be set straight on this, but there seems to be a rather strict segregation of functionality between the CLI and the desktop.

I can find no way of accessing many of the most basic programs from the command line - for example, the mail functionality on the command line is the standard *NIX mail program, or whatever you've installed, but there's no way of interacting with your OSX Mail stored via the Mac Mail program from the command line. Similarly, the calendar is completely inaccessible from the CLI - you need to interact with the desktop to do anything with the calendar.

It's almost like you're using a different computer, so separated are the two environments.

I use VNC to connect to the computer graphically, but sometimes don't want to leave it logged in at home, so I leave it on the login screen. Unfortunately, this means that VNC can't connect until someone's logged in at home...

Is there a way to log in the local user somehow from a remote SSH? Alternatively, are there ways of interacting with certain functionalities usually reserved for desktop applications from the command line?

Is there an OSX-specific manual for the command line that I can use? I'm familiar with Unix, but not when it comes to the Mac-specific functionality...

Thanks,

Nic.

Our Mac HelpMate software can do this, but there's also no reason you should become familiar with the command line. Running VNC over an SSH tunnel is a standard practice, but it is complex and 99% of end users can't accomplish that task. VPNs can certainly help, but it's a real trick to make it as simple as a single - click.
 
Can you just SSH in and run wmaker or something? Or do you really NEED those Cocoa app like Mail, Safari, etc? (Please correct me if Cocoa app isn't the right term for it!!)
 
Have you tried OSXvnc.app with Chicken of the VNC.app? There are other possible combinations. This does let you do what I think you want to do although the solution isn't perfect: (i) you need to use the command line to start the session and then connect to it with Chicken - I haven't managed to get a one-step solution (ii) unless it has been updated, there's a bug which kept causing freezes in Chicken, at least. When that gets sorted out, though, it might be a reasonable solution. There are other solutions - especially if you are willing to pay something (e.g. Timbuktu, some of the other VNC implementations etc.).

For what it's worth...
- cfr
 
You might also want to look at CLIX. It provides you with command line commands that you can use for many system tasks. You can run these commands directly, or add them to shell scripts.

Also, look up the "open" and "osascript" commands. These will let you run applications, AppleScripts and files directly from the command-line.

I have several home-brewed scripts running on my Mac. For instance, since I hate having to load the CD into the drive to play Warcraft III, I have a script that will mount the disc image, start the program, and then when the program closes, it will unmount the disc image again. I have several others, including Perl and JavaScript applets and AppleScript Droplets, that I use regularly. So I would strongly disagree that Mac OS X has a huge disparity between its CLI and its GUI interfaces.

As for using VNC, the key is that you have to be running the VNC server if you want to connect to your computer with VNC. Therefore, the easiest solution is to leave the VNC server running full-time. If that means you need to leave the workstation logged-in but locked, then so be it.
 
You might be interested in some of the following:
1) osxutils (from sourceforge)
2) Platypus
3) CocoaDialog
4) Growl (including the SDK so you can send notifications from CLI scripts etc., with growlctl and growlnotify)
5) xattr (see MacPorts if you can't find this - but you can install it without installing MacPorts)
6) launch (a richer alternative to open)

I use (1) and (4) above a great deal. I use growl to notify me of the results of virus scans from clamav, for example. A shell script is triggered by launchd if a new file appears in my downloads directory. It runs clamav with various options and then uses growlnotify to let me know if the file is all right or not.

The following let you do CLI-type stuff without Terminal and/or let you send CLI output to a non-Terminal interface:
1) ManOpen
2) AquaLess
3) SilverService
4) ProcessWizard

Of these, I use (4) the most, although I would use (3) more if I bothered to set it up correctly.

I see CLIX as ideal for somebody who wants to learn unix, rather than for somebody who knows it. However, it does include some interesting OS X specific commands in the database, so you might find it useful for that.

If you poke around enough, you can find a lot of tools to help integrate the environments, but I've found that (i) I have to do a lot of poking (ii) most of this has to be installed separately - it isn't standard. This is partly because I don't like Applescript, so osascript isn't much use to me. Way too much typing. On the other hand, it is now a lot easier to find these tools than it was.

Would be interested to know if you find anything you find especially useful though, as I'm always looking for ways to bridge the gap. In comparison with, say, a terminal application running under X11 and X11's GUI, there is a huge gap between Terminal and the OS X GUI. Especially if you don't think of Applescript as an acceptable solution (which I don't, though I realise that others find it extremely useful).

- cfr
 
Back
Top