MacOS desktop background won’t change - macos

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.

Related

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/

How to get back Terminal ( Command History + Scrollback ) after manualy quitting the Terminal app?

Sometimes when I update anything from App store and my mackbook pro restarts , when I log in back I found all applications status saved includes my terminal commands history+output darkened in grey color.
My problem , When I do manual restart or quitting the Terminal app , I re-open it with nothing at all !
How Can I get all my commands history+output darkened as a grey text when I manually quit the Terminal app ?
Thanks
Your solution should be found here superuser.com/questions/186805/terminal-output-history
the program is called byobu
Adding the answer here for credit

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.

How to tell finder that my application is installed?

I am working on a cocoa application. I see a strange behaviour on Mac OS 10.6.8..!
My Cocoa application has an Automator action inside it. I want it to be listed in Automator as soon as I install it.
The conditions are as follows:
1. After installation, user should not go to the installed path.
2. User should not launch the application.
I mean, I am seeing this bug only for above mentioned situations. If I go to the installed folder, or launch the application, the automator app gets listed.
I didn't see this defect on Mac OS 10.7.5 or Mac OS 10.8.2..
Also I tried touch command via terminal just in case thinking that if any kind of Access updating is required and all. But that wasn't the case.
Any suggestions? Can I run any kind or Shell/Applescript while installing [After installation of the application] so that I can list the automator action in automator?
Any advice or help would be great!!
You can have a .txt file with the below script and then you have to add postflight script when taking .pkg file in Package Maker.
open "/Applications/yourAppName.app"
Try this Terminal command.
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister .../Whatever.app
You shouldn't hard-code the path, though, as users sometimes stick apps in weird locations (citation: I do it :).

Replaced Finder kiosk

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

Resources