Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Developer can't read files from the /Users/<user name>/Documents folder in Mac OS

JKLNov 6 2020 — edited Nov 6 2020

Folks,
I am at a lost and I need some help. I download the latest SQL Developer for Mac, explode the .zip file and I have the SQLDeveloper.app file (well, folder technically in Mac). I then Copy and Paste this into my Application directory and start up the app. Everything runs fine until when I try to open my .sql files or anything in my /Users/<username>/Documents folder.
I know that Mac OS Catalina has new security model where you suppose to grand access to the Documents or Download folder by app. But my previous version runs just fine without this setup. Also, I have tried to grant SQL Developer Full Disk access in the security setting and it is still not working. When I select File -> File Open and then click on the /Users/<user name>/Documents folder, I am getting the following error message:
I/O error:
The directory /Users/<user name>/Documents is not accessible. Please select a different directory.
The strange thing is that I can select files from the /Applications folder or anywhere else except my own user document folder.
I have even tried to grand the JDK java program full disk access and it is still not working properly.
I also have the same issue with the Oracle DataModeler app as well.
Has anyone seen something like this? Any help is greatly appreciated. Thanks in advance.

This post has been answered by Ray007 on Nov 24 2020
Jump to Answer

Comments

JKL

I also tried SQL Developer 19.x version and it is still behaving the same way. Any help is greatly appreciated. Thanks

Philipp Salvisberg

Has anyone seen something like this? 
I use SQLDev on macOS 10.15.7 and cannot reproduce this issue. Tried with 20.2, 19.4, 19.2.1.
I know that some users had issues when they used a non-default uid (e.g. 502, default is 501). You can get your uid with following command in a terminal window:

id -u

I have a separate user with a non default uid (503). I could open files of that user in the Document folder, but of course access to the other user with the default uid (501) was denied. I suggest to check the uid information of the file and directory with

ls -ln

If the owner uid and the user uid are the same, then I'm running out of ideas.

JKL

Philipp,
Thanks for your suggestion. My uid 502 is the same as the one listed next to the directory when I do the ls -ln.
I may need to completely remove SQL Developer including any hidden folder and re-install from scratch again. It has worked before in the past and I don't know which sequence of events changes this. I don't use the tool too often enough to notice the difference on a regular basis.
Thanks for your response anyway.

JKL

Ok, some more updates. If I just double click the SQLDeveloper.app application icon in the Finder window under Applications, it starts, but with no access to the Document folder.
However, if I start a Terminal window, cd to /Applications/SQLDeveloper.app/MacOS/ directory and do the ./sqldeveloper command, that session will start SQL Developer properly and it will have access to the Document folder.
Also, after I grant /usr/bash Full Disk access, this seems to solve the issue where I can just click the SQLDeveloper app icon in the Finder and it will work as expected. But I don't want bash to have full disk access even though technically, this one is owned by "root".
But I don't want to grant /usr/bash Full Disk access in this fashion and I should not need to. Can anyone shed some lights on this please? Thanks

Philipp Salvisberg

I did some further experiments. When I deny Java the access to the "Documents" folder then I do not see any files via File -> Open... . or in the Files view (in the Documents folder). However I can drag & drop a file from the Finder into an open worksheet. That works.
image.pngWhen I check "Documents Folder" in the dialog above, then I can see all files in the Documents folder via File -> Open... in SQL Developer.
I guess in your case the grant to "Documents Folder" is not given. And for some reason macOS does not ask for it anymore.

JKL

In my case, the Java is already checked for accessing Document folder. But I don't know which version of Java though. Also, strangely, in my case, it only shows that Document folder is available to check, not Desktop and Download folders.
I cannot manually add the program to the Document and Files section. I can do this with the Full Disk Access. Go figure on the Mac side...:(
Anyway, thanks for checking into this. I may just keep the bash grant for now to get around it. I am also wondering if there is a plist file somewhere in the Mac that I can update or review to see if the Java program that is checked is indeed the right Java program.

adnan645

I am facing the same problem. Provided Full Disk Access to both SQL Developer and Java but still unable to access Desktop, Documents and Downloads from SQL Developer 19.2.1.247

Previously, it was working fine for macOS Catalina.

thatJeffSmith-Oracle

When I tried this, it prompted me for permission, I said 'yes' and then the export worked as expected.

image.png

adnan645

Thanks, I tried with 20.2 as well but I faced same behavior. I even tried to provide access to SQL Developer following Full Disk Access in Preferences>Security and Privacy.

JKL

Folks,
So far, the only way that I can get around this issue is to do this:
I grant /bin/bash Full Disk access, this seems to solve the issue where I can just click the SQLDeveloper app icon in the Finder and it will work as expected.
But I don't need to do this in the past. Hope this helps some. Thanks

adnan645

what is /usr/bash ? how to find this from Finder window? I search with 'bash' but didn't find anything. Thanks.

Ray007
Answer

He means /bin/bash
To add:
open security and privacy systems preference pane
click the lock and unlock
click on "Full Disk Access" on the left panel
click the + button to add an app
In the dialog panel that opens up, type "/" to get the "Go to the folder:" panel to pop up
type in "/bin/bash" there and click on open
And good catch. This does work around the issue. It used to work fine on my Mac but has since stopped working properly. In my case, I thought perhaps due to a java update that was applied. I don't want to really grant full system access to bash either...
I see multiple points that could be the issue:
Use of bash when Apple has changed default to zsh so perhaps the bash shell is no longer being treated specially by Apple
I have both OpenJDK 8 and 11 installed and do switch between them so perhaps the permissions granted gets confused between the 2 java runtimes
Bugs in general with Apple's permissions system
The mess of processes needed to set the environment up before launching java

Marked as Answer by JKL · Nov 27 2020
adnan645

Thank you so much. JKL please mark this answer as correct.

JKL

@adnan645 good catch,
@Ray007, thanks for the response as well. I also mark Ray007 answer as correct. Thanks guys.

User_L8JPP

Thanks! Like 3 hours spent guessing what could be, thinking about java issues and it was the damned Macos permissions!
The strange thing is that I had catalina in the past and never happened this to me, always updating from previous versions, though. From a fresh installation of Catalina, donwgrading from BigSur, it started behaving this way.
Anyway, thanks again, was ready to cry!

User_Z3U8M

I have iMac with Big Sur, and managed to overcome this problem by putting my files into the Public directory.

LindsayS

I am not very happy granting full system access to bash - a simple approach (may not suit all requirements), until this is addressed is do not save the files in Documents, Desktop or Downloads. Create a new folder under ~/ for saving all of your work.

dpswind

Are there any "consequences" to granting full disk access to /bin/bash ? I agree with LindsayS and have created a sql folder under my home. Your tip saved me half a day. Thanks. -Steve
macOS Big Sur 11.2.3 SQL Developer Version 20.4.1.407 Build 407.0006

croca

Giving full access to /bin/bash worked for me.
OSX BigSur.
SQLDev20.
I had to apply minor changes to explanation provided by Ray007.
open security and privacy systems preference pane
click the lock and unlock
click on "Full Disk Access" on the left panel
click the + button to add an app
In the dialog panel that opens up, type "/" to get the "Go to the folder:" panel to pop up. This did not work for me. What I did:
instead of typing "/", press Apple shortcut "Shift+command+G" so box showed up and then typed "/bin", this way all contents in folder showed up and choose "bash"
then click open
finally, "Click the lock to prevent further changes", if not, changes are not applied.

Sqldeveloper works great after that.

croca

Giving full access to /bin/bash worked for me.
OSX BigSur.
SQLDev20.
I had to apply minor changes to explanation provided by Ray007.
open security and privacy systems preference pane
click the lock and unlock
click on "Full Disk Access" on the left panel
click the + button to add an app
In the dialog panel that opens up, type "/" to get the "Go to the folder:" panel to pop up. This did not work for me. What I did:
instead of typing "/", press Apple shortcut "Shift+command+G" so box showed up and then typed "/bin", this way all contents in folder showed up and choose "bash"
then click open
finally, "Click the lock to prevent further changes", if not, changes are not applied.

Sqldeveloper works great after that.

User_VKEF2

LindsayS, this worked great for me, thx?
"a simple approach (may not suit all requirements), until this is addressed is do not save the files in Documents, Desktop or Downloads. Create a new folder under ~/"

Pavol Babel

I just wonder if this could be solved in other way for Java applications... For a native macos application(for instance in objective-c) , there exist API for application to ask permissions for Desktop/Documents etc. But not sure if such API exists in JDK for java applications (as this would not be portable). So every java application on MacOS will probably run into this issue...

1 - 22

Post Details

Added on Nov 6 2020
22 comments
29,112 views