0

I'm trying to have multiple versions of STS start with their own workspaces via command line args and tried this as a reference.

It results in a:

$open -a ~/Applications/STS.app --args -clean
FSPathMakeRef(/Users/xxx/Applications/STS.app) failed with error -43.

Where is the executable for STS located?

I'm on MacOS High Sierra v.10.13.6

As far as I can remember, STS was initially downloaded as spring-tool-suite-3.9.3.RELEASE-e4.7.3-macosx-cocoa-x86_64.dmg and installed that way.

I read that on Mac one can right click on the .app and 'Show Package Content' which I tried:

enter image description here

However accessing it from the command line still doesn't work:

$ls -la ~/Applications/STS.app/Contents
ls: /Users/simeonleyzerzon/Applications/STS.app/Contents: No such file or directory

Per @greg-449's comment, I'm now trying to open STS and point it to another workspace location:

$ open -a /Applications/STS.app -data /temp
open: invalid option -- d
Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-s <partial SDK name>][-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
Help: Open opens files from a shell.
      By default, opens each file using the default application for that file.
      If the file is in the form of a URL, the file will be opened as a URL.
Options:
      -a                Opens with the specified application.
      -b                Opens with the specified application bundle identifier.
      -e                Opens with TextEdit.
      -t                Opens with default text editor.
      -f                Reads input from standard input and opens with TextEdit.
      -F  --fresh       Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
      -R, --reveal      Selects in the Finder instead of opening.
      -W, --wait-apps   Blocks until the used applications are closed (even if they were already running).
          --args        All remaining arguments are passed in argv to the application's main() function instead of opened.
      -n, --new         Open a new instance of the application even if one is already running.
      -j, --hide        Launches the app hidden.
      -g, --background  Does not bring the application to the foreground.
      -h, --header      Searches header file locations for headers matching the given filenames, and opens them.
      -s                For -h, the SDK to use; if supplied, only SDKs whose names contain the argument value are searched.
                        Otherwise the highest versioned SDK in each platform is used.
charles ross
  • 570
  • 4
  • 15
Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82
  • Applications is `/Applications` - in the root file system not in your home directory so no `~`. – greg-449 Oct 23 '18 at 20:05
  • Thanks @greg-449. Any idea on the syntax for the MacOS to refer to another workspace location (via -data). That seems to not work on Mac? I'm trying this: `open -a /Applications/STS.app -data /temp` – Simeon Leyzerzon Oct 23 '18 at 20:07
  • No sure what you mean.The /Applications location is the install directory not a workspace. A normal Unix path should work for the workspace location on -data. – greg-449 Oct 23 '18 at 20:09
  • @greg-449: it should, but it doesn't seem to, perhaps I'm missing some quotes or something. I've updated the question with clarification on this part. – Simeon Leyzerzon Oct 23 '18 at 20:11
  • You are missing --args on the open command - see answer – greg-449 Oct 23 '18 at 20:16

1 Answers1

1

Applications is /Applications - in the root file system not in your home directory so no ~.

So just:

ls -la /Applications/STS.app/Contents

For your open command you are missing the --args option that tells open the rest of the command line is for the application:

open -a /Applications/STS.app --args -data /temp
greg-449
  • 109,219
  • 232
  • 102
  • 145
  • So, I'm now using `open -a /Applications/STS.app --args -data ~/workspace/spring-security/ -clean -showlocation -vmargs -Xmx1024m -XX:MaxPermSize=256m` and it opens STS. But, normally when Eclipse opens up in a new workspace, a new `.metadata` file gets created in that workspace directory. With the above command, that is not happening somehow. Am I still missing something? – Simeon Leyzerzon Oct 24 '18 at 14:12
  • I'm trying to model the behavior in Mac OS similarly to what I'm seeing in Windows with a command akin to: `open -a /Applications/STS.app --args -data ~/workspace/spring-security/ -clean -showlocation -vmargs -Xmx1024m -XX:MaxPermSize=256m` – Simeon Leyzerzon Oct 24 '18 at 14:14
  • 1
    Files and directories starting with '.' are hidden by default in macOS. The .metadata is created but Finder doesn't show it. `ls -a` will show it. On recent releases of macOS pressing Cmd+Shift+. (dot) will show hidden files. – greg-449 Oct 24 '18 at 14:19