Hristo
Hristo

Reputation: 46557

How can I share an Eclipse workspace between accounts in Mac?

I basically want to create an Eclipse workspace that can be accessed between accounts on my Mac. I'm currently running Mac OS X v10.7.1. The other caveat is that I want to be able to do use Git on that workspace so I can push and pull from both accounts. If this is not possible, I'm ok with switching accounts to do the Git stuff.

Is it possible to create an Eclipse workspace that can be accessed between 2 accounts in Mac OS X Lion? Do both accounts need to be admin or not? If this is actually possible, how would I go about setting this up?

Here's some more info about my accounts (both admin, I think?)...

$ id HristoOskov
uid=501(HristoOskov) gid=20(staff) groups=20(staff),403(com.apple.sharepoint.group.2),404(com.apple.sharepoint.group.3),402(com.apple.sharepoint.group.1),401(com.apple.access_screensharing),12(everyone),33(_appstore),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),100(_lpoperator),204(_developer)

$ id dev
uid=502(dev) gid=20(staff) groups=20(staff),403(com.apple.sharepoint.group.2),404(com.apple.sharepoint.group.3),402(com.apple.sharepoint.group.1),502(access_bpf),401(com.apple.access_screensharing),12(everyone),33(_appstore),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),100(_lpoperator),204(_developer)

... and how the directory that I want to have Eclipse use as a workspace...

$ ll
drwxr-xr-x   4 dev  staff   136 Sep 16 18:38 .
drwxr-xr-x+ 39 dev  staff  1326 Sep 17 03:59 ..
drwxr-xr-x   4 dev  admin   136 Sep 17 03:24 myWorkspace

What I've tried...

So I tried making the directory that I want to put the workspace in owned by root but then Eclipse complains when I try to create a project...

Creation Problems
Parent of resource: /Users/HristoOskov/Sites/random is marked as read-only.

Then I realized that I didn't clear out the directory properly before trying to create a workspace. Now, I have fully cleared the destination directory and I tried to create a workspace again and am faced with this error...

error

Upvotes: 2

Views: 1271

Answers (3)

Hristo
Hristo

Reputation: 46557

Figured it out! Here are the permissions for the workspace...

/Users/Shared $ ll
drwxrwxr-x  3 root         admin   102 Sep 18 19:45 myWorkspace

The trick is opening Eclipse as root. This is the command I use to do so...

// /Applications/Eclipse is the directory where eclipse.app lives
$ sudo /Applications/Eclipse/eclipse &

... and this runs an Eclipse instance as root and I can access the workspace from both accounts!

I can even still work with Git, however, I must do sudo git [command] every time... but I'm ok with that.

Upvotes: 0

Cajunluke
Cajunluke

Reputation: 3113

Put the workspace in /Users/Shared and make sure both users have read/write access to the files (including Eclipse's special hidden directories).

Upvotes: 1

Lars
Lars

Reputation: 5799

Yes it should; however, you might experience a blocking, if you open the project simultaneously in both accounts. Try to reset the access rights to 777 to determine, if it is a rights problem or a blocking problem:

chmod a+rwX /Users/HristoOskov/Sites/ -R

If you are able to add the project in both accounts now, make sure both accounts are in the admin-group and reset the group and rights to admin

chown .admin /Users/HristoOskov/Sites/ -R
chmod u=rwX,g=rwX,o=rX /Users/HristoOskov/Sites/

If you were not able to add it with the same message, reset the rights as stated above and make sure, that both accounts are in the admin-group. If not so, add both accounts and try again:

id Account1
id Account2

If in the result, any of the two accounts is not in the admin-group, you may add the account (in this example Account2) with the command

Add the user to the admin-group with the command /usr/sbin/dseditgroup -o edit -a Account2 -t user admin

Then restart above.

Upvotes: 1

Related Questions