0

This used to work in pre-Mountain Lion OS X:

tell application "Terminal"
    activate
    do script "cd /"
end tell

Now, the new bash window is opened, but nothing is executed, no mater what the command-line script.

It's broken on the few systems I've tried it on, but is it a general problem? Is there a workaround?

2
  • @digiMonk Brilliant! Along with Reynhout's comments, this made me revisit the Startup options. You're right -- changing "Shell opens with" to "default login shell" fixes it. Commented Mar 28, 2013 at 2:25
  • Cool, I write it as answer Commented Mar 28, 2013 at 2:49

2 Answers 2

1

Works as expected for me.

Any recent changes to your environment or .bashrc?

bash$ cat t.applescript 
tell application "Terminal"
    activate
    do script "cd /"
end tell

 

bash$ osascript t.applescript
tab 1 of window id 9766

  New Terminal window opens, "cd /" is visible in buffer, and shell is at /.

bash$ uname -smr
Darwin 12.2.0 x86_64

Edit: verified on 10.8.3 too

bash$ uname -smr
Darwin 12.3.0 x86_64
Sign up to request clarification or add additional context in comments.

1 Comment

I think my edit overlapped your comment -- just to be sure, I tested on 12.3.0 as well, same results. One idea: try creating a new user and doing the test there. That would rule out anything in your environment.
1

Check Terminal.app's Preferences, there are many options for new windows and what Shell to open at startup and many more–

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.