Replaced Finder kiosk - macos

I am trying to make a kiosk, I actually wanted to lauch my app before the Finder got launched, I wrote the following command:
defaults write com.apple.loginwindow Finder ~/Desktop/myapp.app
and it worked, but now I have a huge issue, my Finder wont get launched at all, instead everytime my application is launched when I press the Finder, Before I was getting erroR -10810 but I fixed that. I tried reversing the process but it isnt working. My mac is useless and I cant get to my files.
Target is to reverse the process and make my finder works again as normal

Related

App only fails when running from finder - How to find error?

I've got a MacOS app, written in Python, using Tkinter, and built into a MyAppName.app bundle with pyinstaller.
When I run open -a MyAppName in terminal, everything works, great.
When I run /path/to/app/dist/MyAppName.app/Contents/MacOS/main, it works and I see terminal output. Great!
However, when I double-click on MyAppName.app, it bounces around in the icon tray a bit then disappears. If I change the app to just open a message box, it works, so I know it's something about the app itself that's wrong.
How can I debug this? Is there some way I can see the logs from the app after opening it in finder, so I can find out what is crashing?

MacOS desktop background won’t change

I was playing around with a python script that downloads and changes the wallpaper, and suddenly the wallpaper went black and won’t change even through the preferences menu. The dock also stopped working and I am no longer able to switch apps using cmd + tab.
I tried restarting the computer, resetting the PRAM, deleting both the com.apple.finder.plist and the com.apple.desktop.plist files, and running a defaults write com.apple.finder CreateDesktop true; killall Finder command. If I run a killall Dock it says they there are no Dock processes running.
The python script I was playing with was just running a simple osascript:
/usr/bin/osascript<<END
tell application "Finder"
set desktop picture to POSIX file "%s"
end tell
Nothing worked. Any ideas on how I could fix this problem? Im on Monterey.
I found a solution. It was hidden in a comment on another similarly related stack overflow question here.
As described by one of the comments, the problem happened after trying to set a malformed image file as my background. I followed the suggested step to delete my ~/Library/Application Support/Dock directory, which solved the problem instantly.

Calling open in Terminal in MacOS brings another program to the foreground

I have two application bundles (called ProgramA and ProgramB) that I have written for MacOS. If I use open in Terminal to launch one of them it will launch just fine. But if I try to use open to launch the other one while the first one is open, it will instead bring to the foreground the already launched app. For instance, if ProgramA is already open and I use open -a ProgramB, Program A will instead come to the foreground.
I know I can use open -n -a ProgramB to ensure a new app is launched, but I would like to keep the behavior of bringing the app to the foreground if it already running. If I double-click the icon in Finder the apps will open as expected. The apps are being launched by another app so just using Finder isn't an option.
I thought maybe the issue was a duplicate key in the Info.plist that is used by the system, but that doesn't seem to be an issue. The values for the following keys are unique between the two apps:
CFBundleIdentifier
CFBundleExecutable
CFBundleName
Is there a way I can get open to launch the correct app if other app is already running?

Sandbox is not allowed to open documents in Terminal

Recently I developed an application in Xcode using Swift that starts up the Terminal like this and:
open -a /Application/Utilities/Terminal.app /project/run_stack.sh
After exporting the Application and trying to run it I get this message if my Terminal is running already or I have previously started the same command from the same app (the command is executed through a menu item).
ru_stack.sh can’t be opened because Sandbox is not allowed to open documents in Terminal.
Anyone know why this happens ? If I run it on my Mac it works fine and each time a new terminal starts on the call but when I tried the application on my friend's Mac we get that error in the described cases.
I was having the same problem. I ended up setting iTerm2 as the "Open With" application for .sh files and that fixed my issue. https://iterm2.com/

Disable OSX Mavericks' "Do you want to try to reopen its windows again?" popup

I'm using OSX's launchctrl functionality to automatically relaunch an app after it crashes.
Unfortunately, when the app relaunches, it launches together with an action window that reads:
"The last time you opened MyAppName, it unexpectedly quit while reopening windows. Do you want to try to reopen its windows again?"
I tried to suppress it by calling NSQuitAlwaysKeepWindows
defaults write -app /Path/to/app/MyAppName.app NSQuitAlwaysKeepsWindows -bool false
But this only works some of the time - I'd say that the popup window launches 50% of the time.
This window requires action and blocks the app from jumping into a full screen mode.
I'm on OSX 10.8.4
Thanks for any ideas ...
Jeremy
Open the folder "~/Library/Saved Application State" and look for a file like "some.url.MyAppName.savedState".
Deleting this file might probably solve the problem, at least it worked for me.
I was able to fix mine by deleting the Envelope Index file(All the files with the name "Envelope Index") under /Library/Mail/V2/MailData folder.
Then restart the mac.

Resources