How to make application autorun on Mac? - macos

I want to make my application autorun, like using autorun.inf on Windows. I googled and there is one way for me to do that:
"On the Mac side there are many applications you can buy for creating a Finder window that looks a certain way but all these changes can be made within finder. You then will need to copy the DS_Store file to the CD and finder will automatically apply any changes that you have made.
Also using -hfs-openfolder will cause it to open automatically when inserted on the mac."
Can anyone tell me more clearly about that, or is there any other way?
Thanks so much.

According to this page, you should be able to do that with bless:
sudo bless --folder "/Volumes/discName" --openfolder "/Volumes/discName"
The man page confirms that, at least on 10.6.8. I don't have Lion in front of me right now.

Related

How to programmatically uninstall App that install DriverKit system extension

I have an app that installs a DriverKit system extension when it launches.
If I then drag this app to the Bin from /Applications then I am prompted about that the app also manages a system extension and that the system extension also will be removed.
I would like to have an uninstaller that removes the app. I have tried to remove the app in the uninstaller with rm -rf, but then the system extension is not removed.
I have also tried the trash terminal utility (can be installed with brew install trash) to check if something similar could be used from the uninstaller, but without luck.
Is there a way to programmatically remove an app and also the system extension that the app installs.
Good question! I don't have a fully baked answer, but enough suggestions to try that they won't fit in a comment, so here goes anyway:
Try using Cocoa APIs for "trashing" files. This answer gives a good rundown. I don't know how this will cope with the system extension confirmation though.
If you definitely want to pop up the confirmation dialog, using AppleScript to tell the Finder to delete the file is a great approach. I can confirm the solution given in this answer works but it will show the confirmation dialog, which may or may not be what you want.
You can uninstall a system extension (including a dext) using the systemextensionsctl uninstall command. Unfortunately, this will always pop up an authentication dialog, even if you run it with root privileges. But depending on what you're doing, that might be preferable to the above.

Clear Recent items in Preview Application of Mac OS X..?

Hello all,
Can anyone tell me how to clear the 'Recent items' list in Preview application of Mac OS X through code? Is there a terminal command that can do this?
Or is there any way to click on 'Clear Menu' in 'Open Recent' of the 'File' menu in Preview?
Alternatively, does someone know where Preview stores this information and how do to remove it?
Check out this image to see what I mean.
Ok, so none of the described methods on the websites I could find actually succeeded in getting rid of all the 'recent document' lists in all of my apps.
I feel the most common sense approach would be (for OSX 10.12 / Sierra):
First go to system settings > general and choose "none" in the recent file dropdown menu (my OSX is in another language so the exact terms might be different, but you should be able to see what I mean). / This will get rid of most, but not all recent-items in different apps.
Get familiar with Apple's 'defaults' command in terminal. Now, hunt for any lists you might still want to get rid off, e.g. none of the options mentioned in the answers already listed here helped to get rid of the recent-items list in Finders "GO" menu. I played around with the defaults command and found that: "write com.apple.finder "FXRecentFolders" '({})' && killall Finder" does the trick for me. Playing around I found similar solutions for many of the other apps that where still able to maintain a list of recent items.
Create a shell script containing the commands you found during step 2.
Schedule the script to be run automatically on a preset interval or action (e.g. log out). AND/OR create an alias in your shell's profile (or directly apply the script as a function inside it) so you can call it with a single command from your terminal. (for instance: I have created an alias to it, so when I now type "killrecent" in terminal, it empties all the recent-items lists I've been able to find.
Hope this will be of some help to others. Good luck!
open Preview ->- go to File ->- Open Recent ->- Clear Menu
You may try the approach outlined here, which is to run
defaults delete com.apple.Preview.LSSharedFileList RecentDocuments
in the Terminal (manually or through your app). However I tried this and it didn't work for me (OSX 10.11), since the Preview defaults file doesn't contain this entry.
You can use
defaults write com.apple.Preview NSRecentDocumentsLimit 0
which will hide all recently used items, but as soon as you set that number to anything greater than 0, they will show up again.
I also checked the ScriptingBridge Interface for Preview, but couldn't find anything useful. So unfortunately it looks like this is not possible.
with 10.11, there are at
~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.preview.sfl

xcode The document "..." could not be saved

I use xcode 3.2.4 on snow leopard. Today when I tried to save a file on my project I get an error message saying: The document "nameOfFile.m" could not be saved. I tried reinstalling xcode but no luck. The file can be edited with other editors and I see the same behavior on all my projects as well as newly created projects. Any ideas?
Simply by rebooting the computer the issue was fixed.
We were having this problem in a lab environment where user files are mounted via NFS.
The client machines are running OS X 10.6.7 and the file server is running Debian Linux.
After much grief and reading /var/log/syslog on the client machine I discovered it was a subtle file locking / race condition issue with the file system. Evidently, when editing files in a "bundle" (e.g. as in an Xcode project), the OS is using some form of "safe writes" which involves writing transient data atomically to ~/Library/Caches/TemporaryItems/ (which of course is on the NFS mounted system) -- there is a race here that requires proper file locking. We hope we have fixed the problem by changing the nfs_mount options
as described in Mounting NFS volumes in OS X
Not sure why but the temp files ended in a odd state. In "/private/var/folders" I simply removed all the folders and it cleared up the problem
cd /private/var/folders
sudo rm -fR *
Note: never do a "sudo rm" unless you really know what you are doing. It can cause irrecoverable damage
I restarted XCode (by a force-quit, not just closing it) and that fixed it for me.
Make sure you have you mouse focused on the code area and not the file in the file list.
Cleaning the project (Product > Clean), then force quitting Xcode (Command + Option + Escape, select Xcode, click Force Quit) solved the issue for me. I'm not sure if the clean was necessary, but that was what I did. Upon re-opening the project, I let Xcode index the project before doing anything, then did a Build, and all is well.
Force quiting Xcode for me worked. I would recommend the same.
Hey........... even i faced the same problem..... But got the answer......
steps:
reveal in folder the project.
select the file that is locked
select 'GEt Info'
deselect ie uncheck the label 'LOCKED' in the Info.
I just ran into the same problem, then I noticed I ran out of disk space. You can disable the warning that pops up when you run low on disk space (perhaps not a wise thing to do). I did that a few days ago and was puzzled for a moment when this message appeared. They could've just said "Disk full" or something instead of "cannot save". Anyway if anyone ever runs into this just free up some disk space.
You might be able to save in an external editor because its not also building your app which might use up the little remaining space. It might also be why it worked after rebooting (if OS X cleaned up some cached stuff on reboot) so it seems plausible.
Either that or your HDD might have just crashed.
tic....tic....tic.....
In my Case, the File which was saying document could not be saved was basically Shortcut/Allies of the file present at another place.
I don't know why it was not able to save if it was opened by shortcut/allies in xcode but by overwriting(Copy and Paste) the orignal files to that shortcut my problem was solved.
Regards
Umair Bhatti
1.Right click on that file
2.Go to Show in Finder .
3.Click on get info .
4.Goto Sharing & Permission
Everyone,username,Fetching & selection ----You can choose appropriate read write option.
I have face this issue many times. I followed below steps to fixed this.
1. Select file->Show in Finder
2. Copy those file and past different destination.
3. Remove those file from xCode (to selecting show in finder)
4. Then again add those files from other destination to actual location
5. Clean code and run the code.
Another possible reason is that the file you are trying to modify is an alias (i.e. a soft link).
You will have to modify the source file directly in this case.
Thanks #Wayne Cochran,
When I use Xcode to save it, I rebooted the machine several times, and all failed.
So I changed to Visual Studio Code to edit and save. Then it's OK.
Just change the file editor
This can happen when you are working with a network hard drive (or are on a cloud) and not connected to the network (connection lost)

Where is ~/.config/MonoDevelop/ for MonoDevelop

I'm using Mac Snow Lepord and can't find "~/.config/MonoDevelop/" for the life of me. I have MonoDevelop (v2.2.2) up and running already, but when I tried to set up a template the IDE started having problems.
Namely, whenever I went to Monodevelop -> preferences-> Code Templates I would get an error saying "Argument cannont be null".
I tried removing MonoDevelop from my Mac and re-installing but that doesn't appear to fix this problem so I thought if I could find the above folder maybe I could remove that. However I am not sure how to find it. I put the address directly into Mac's "finder" search box and no results were returned.
Can anyone help?
Note: You are not going to see your .config directory in your user directory in finder unless you show hidden files. You are going to have to get there via bash in the Terminal.
The tidle ~ would normaly expand to your home directory, e.g. ~/foo.txt is /path/to/your_directory/foo.txt, depending on where 'home' is on any given system.
So, the file you are looking for is /Users/your_username/.config/MonoDevelop/ ...
Also, there are some shells / systems that simply do not support tidle expansion.
Since you are on a Mac, you'll actually have to go to ~/Library/Prefernces/MonoDevelop-2.x to do your install.

Creating a dual Mac/Win Autorun CD

How do I create a CD that opens a "Drag this icon to the Application folder to install" on the Mac and autoruns an installer on Windows?
Jordan Brough has a really good write-up on his blog about this:
http://jordan.broughs.net/archives/2008/03/creating-cross-platform-windows-and-mac-installer-cds
For what it's worth, this was the first result returned from a fairly simple google search...
You can use hdiutil
eg.
hdiutil makehybrid -o [output-file] [input-folder] -iso -hfs -hide-iso [mac-only-file] -hide-hfs [windows-only-files]
What you will want to do is hide the windows specific files from the HFS partition and hide the Mac only files from the ISO.
Then you would use an autorun file as your normally would on Windows.
On the Mac side there are many applications you can buy for creating a Finder window that looks a certain way but all these changes can be made within finder. You then will need to copy the DS_Store file to the CD and finder will automatically apply any changes that you have made.
Also using -hfs-openfolder will cause it to open automatically when inserted on the mac.

Resources