How to change file associations in Mac OS X - xcode

So I used Xcode and all. Now, whenever I open my text files it opens automatically with Xcode. How do I undo this?

RightClick on the file name -> Open With -> Choose the editor you wish to open with this kind of file. And that sets to be default editor for opening files with that particular file extension ( i.e., .txt ) when opened in future.
Edit: The above procedure is not a permanent one. Try this -
Right click on the file name.
Choose Get Info
Choose one from the Open With drop down. This will be set as default application and is used in future if opened the .txt file.

Right-click any text-file an select "Get-info", then choose your preferred Text-editor under "Open with" and click "Change all..."

You can change program association by right clicking on your file and clicking on "Get Info". This will bring up another dialog in which you can change the program associated with that file type.
You can find visual instructions here: http://osxdaily.com/2009/10/25/change-file-associations-in-mac-os-x/

Related

XCode: Quick open property list file e.g. info.plist as source code?

In Xcode you can "quick open" files by selecting File/Open Quickly. When I enter the file name of a plist file, then this file is opened as "Property List". But often I want to open the file as "Source Code". How can I quick open property list files as source code?
The fastest method to open property lists in Xcode as source code is the following:
Press ⌘+⇧+o to get the Quick Open Dialog
Enter name of property list file e.g. "info.plist" and press "Enter"
Open "Version Editor" -> Property List File is shown as source code
Hmmm....I don't think you can, unless you set up the Open As > source code commands as a custom behavior with a key binding.
Apple is discouraging opening plists as raw XML. Their guidance on how to deal with .plists is here
I was able to accomplish most of what I needed with that, especially after discovering the trick for showing the actual names of the keys:
Important: The property list editor in Xcode displays human-readable strings (instead of the actual key name) for many keys by default. To display the actual key names as they appear in the Info.plist file, Control-click any of the keys in the editor window and enable the Show Raw Keys/Values item in the contextual menu.
If you still need to see the .plist source, though, there are two ways:
1) show the version editor. The source of the previous and current versions are shown side by side.
2) use the file browser... (there should be a way to automate this with Xcode behaviors)
Hold the Control key while selecting the file in the file browser.
Select 'Open As..'
Select 'Source Code'
It's certainly not as fast as OpenQuickly, but it does work.
Xcode 12
Right-click Info.plist > Open As > Source Code

Change all file icons with same type [Yosemite]

I have many excel files in my computer, and the icon of all of them are plain paper, like this:
I want all icons to be .numbers icon. Do anyone know how to do that ?
Here's what you could do :
Open a Finder window and navigate to /Applications/
Find the app whose file icon you want to change
Right click it and select "Show Package Contents"
Navigate to Contents/Resources/ and find the appropriate icon file. Replace it with your new icon file.
Restart your computer to update the icon cache.
Or you can change the default app for a file type and set all files of that type to be associated with the default app if that's what your question says:
Open a Finder window and locate the file type you want to change.
Push Command+i or go to File > Get Info
Under "Open With" select the app you like. You have just changed the default app for that individual file.
To change the default for all files of that type, push the "Change All" button and then "Continue"
This will make all your excel files to open with numbers while the previous one will just change the icon
To change the file icon on all you files icons with the same extension:
open Get Info panel file 1, that you want to change
open Get Info panel file 2, that you want to change to
drag and drop icon from panel file 1 to panel file 2
click Change All...
with Finder open "Show View Options" or command + J
drag Icon size as you wish. This force icons cache rebuild
Here is a simple solution that works all times:
Find the file with icon that you want to apply for (ex: *.numbers file), then Command + i to open it's info Panel
Find the file you want to apply the icon for (ex: your *.xlsx) file. then Command + i to open it's info Panel
Now that you have your two file's info panel side by side, you can drag the icon from the first file's panel ( only from header/title bar ) and apply it to a second file's panel, as shown: (you must place the icon over the second icon to make it work, I didn't make it overlap just for taking a clear screenshot)
Open a champagne and celebrate!
You have to empty your cache for icons after you have changed the icon or switched the file association program.
Not sure the exact filename, but use it to empty both cache folders. ~/Library/Caches and /Users/User/Library/Caches

Xcode - open current file in a NEW window (a real challenge !)

Say you have File.m showing in the blue area above.
I want File.m to open in a new separate window.
How to do this??
Note that - of course - IF you have the ProjectNavigator showing and IF you can see the filename "File.m", then double-click on the filename and it will open in a new window.
What I want to do is open ANOTHER copy of the "CURRENT" file (the one in the primaryEditor) in a NEW WINDOW - without touching the ProjectNavigator.
Any ideas? Cheers
Note that ... (an excellent page here)
http://realmacsoftware.com/blog/xcode-4-s-less-obvious-shortcuts
if you click on whatever file is in the current primaryEditor, then shift option apple comma that will indeed open the following "freaky little-known Xcode popup" ...
you can then, indeed, choose to open a new window. (So to be clear, that is exactly what I want to do.)
So, I want to be able to do that in one step. Cheers!
In XCode's Preferences you can change the following:
And then right-click within the primary editor and click "Open in Separate Window"
Edit:
Instead of right clicking in the primary editor you can simply type command+option+, (comma)
Open the file what you want to open in the NEW window.
Command + Shift + t
Open the file what you want to open in the separated window.
Command + Option + ,
I wrote a new automator service that does the following steps in Xcode:
Execute the default shortcut for the "Open in..." menu item (Command-O)
(if this isn't your current "Open in" shortcut, the workflow will not work. If you still want to test it, just changed your default shortcut :) )
Go all the way to the left in the weird "Open in" view
hit Enter
Current file opened in new window
The only thing you need to do is install the service on osx and map a shortcut to it.
Here a download to the service:
https://www.dropbox.com/s/486t2iz17o0l9dh/Open-New-Window.zip
INSTALL INSTRUCTIONS
1.Place Service file in folder ~/Library/Services
2. Open "System preferences"
3. > Keyboard
4. > Tab "ShortCuts" > "Service" > "General"
5. > Set your own shortcut for the service
6. Go to XCode and test the service by using your very own shortcut
Tested on OS X Mavericks, Xcode 5.0.1
In XCode 4 you can have a split window via View -> Show Assistant Editor. Then choose the same file which you have already opened in the Primary editor by the small right arrows on top of Assistant Editor.
Thanks
in the ProjectNavigator. If you see the file name: Double click on the file name. It will open in a new window.

How to set an external editor in Xcode 4.2

All the posts I have found suggest going to the "file types" sub-section under XCode preferences and adding an external editor for a specific file type. However this options does not seem to be there on XCode 4.2.
It looks like it just goes through LaunchServices, so... whatever you'd get by opening it using Finder by default.
I had a look around and I couldn't figure it out. I notice that right-clicking on a source file, there is a greyed out option for "open in external editor." I couldn't figure out how to get that working at a glance.
A reasonable workaround would be to right-click on the source file you want to edit, click "Reveal in Finder," and then edit the file in the editor of your choice. The changes will be automatically updated in Xcode. I think you'll lose any undo/redo history you may have had for that file in Xcode though.
you have to make the editor you want is the default editor for the file type(cpp/h/lua ..).
step: first time you 'show in finder', then open the file with 'open as', then choose the editor you want, make sure you choose the 'always open it'. then every is ok now.
I agree that you need to change the default setting for the file type in Finder. The best way to do that is to right-click any similar file in Finder. Select Get Info from the pop-up menu. Then look down the list for the "Open with" drop-down option. Select your chosen editor and then below the words "Use this option to open all documents like this one" click on "Change All..."
Then it will change the default for all your applications.

Xcode 4: Open arbitrary files in assistant editor

Is it possible to open a file that is not part of any project in the assistant editor? Open Quickly can open files in the assistant, but only searches the project itself. If I open an outside file in Xcode, it gets a new window that cannot access the project in its assistants.
With the assistant editor open, drag the file from the left-hand list onto the Jumplist at the top of the assistant editor (where the currently open file is).
Yes, it's possible.
#What. Your answer only works if the file is in the project. You can only drag a file to the Jumplist at the top of the assistant editor if the file is displayed within the file list on the left. This means you would have to add the file to the project before opening. Sometimes, this is not desirable as you may want to open a file from another project for reference while coding.
Steps that I use are: (Tested in Xcode 6 and Xcode 7 Beta)
In Xcode, make sure your Tab Bar is shown. If it is not, click on "View -> Show Tab Bar" in the top menu
Open the file... Go to "File -> Open". Select the arbitrary file you want to open. This will open the file in a new window. (Screenshot 1 below)
Drag the tab in the new window to the tab bar in your main editor. Now, you will have 2 tabs in your main editor and your new window will be gone (Screenshot 2 below)
Next, click on your original tab (Where your main and assistant editor is) and the file will be available in the recent files list. Simply select the file from the recent files list in the assistant editor and you now have the file open in the assistant editor. You can also close the other tab as you no longer need it. (Screenshot 3 below)
Screenshot 1. Simply drag the tab from the new window to the main tab bar.
Screenshot 2, you will now have 2 tabs.
Screenshot 3. Back at your original tab, you now have the option to open the new file within the recent files list in the assistant editor. Click it and you are done.
Screenshot 4. Final result... we have our arbitrary file open in the assistant editor.
Here is what I do (Xcode 9.3) :
Add wanted file to the Xcode project
Open assistant editor with that
file
delete this file (references only) from the Xcode project. Xcode will
remove the file from the assistant editor.
Now go to the assistant
editor "recent files", the file will be there. Select it.
My preferred way to do this is to #include whatever file I want to open in some C file, like this:
#include "/home/julius/path/to/file"
Command-clicking the path will open the file. It's a shame Xcode forces you to use this workaround.
You can drag an arbitrary file on the assistant editor. Then it will be opened there.

Resources