XED: The Lightweight Text Editor for Xcode

An Xcode is an integral part of the iOS application development. As an iOS Developer, we work with Xcode most of the time. In case of something unexpected, we quit and restart Xcode which magically fixes our problems most of the time. Normally we open Xcode from the Spotlight, Dock or Application folder and open our application workspace or project. However, there is an unnoticed command line tool which can be used to perform some lightweight tasks with Xcode. The command line tool is known as xed there is an online manual for the xed here but we can always type man xed in the command prompt to get more information about the XED command line text editor for Xcode. In this post, we will see how we can use XED to perform some lightweight task quickly with Xcode.

What is XED

The xed is Xcode Text Editor Invocation tool which means we can use xed for opening, editing, creating files inside the Xcode. You can treat xed as a vim or atom command for the VIM or Atom text editor. The xed opens the Xcode from the command line. We can use it for opening workspaces, files or creating new files. We will cover common use cases for the xed in this article.

Opening Xcode Project/WorkSpace

In order to open the Xcode project, we normally navigate to our project workspace and double click on the .xcworkspace  or .xcodeproj  file which opens the project/workspace in the Xcode. Some developers use the command line tool open to open the Xcode project/workspaces.

This will also open the Xcode workspace in the Xcode. However, there is a better way to open the Xcode project/workspace with the xed. With xed command, we have to navigate to the root of the project and type.

This will open the current workspace in the Xcode. The xed process will finish and exit when the Xcode project is opened.

Opening/Editing A File from Xcode Project

Sometimes, you need to edit the single file from the Xcode project without the need to launch the entire Xcode project or workspace. We can edit the single file using file using vi or vim editor but with xed, we can use Xcode to open and quickly edit the file. Let’s say, we need to edit the .travis.yml file from the Xcode project without opening an entire workspace. We can open the file in Xcode using

This command will open the .travis.yml file in the Xcode and we can quickly edit the file and save the changes without a need to launch entire Xcode project/workspace. This can also be applied to the Swift files where we can take benefit of the Xcode’s autocompletion feature.

 Creating the New file with Xcode

It’s possible to create a new file with the xed command and we can also add the content to the newly added file when opened with Xcode. Let’s create a test.swift file using the xed command

Note that, we have passed -xc to the xed command which means we have created the file as well as launch the Xcode. After executing the above command, Xcode will create the test.swift file and opens the file for editing. We can then add the content to the file and save it.

Note: The file created by the xed is NOT referenced in the Xcode project, we have to manually reference the file inside the Xcode.

There are a couple of more use cases that can be used with the xed like

  • Passing the --line and line number will select the line number in the last file opened. This would be useful to quickly jump to the line number in the given file.
  • Passing the --background will open the Xcode without activating it.


The opening and closing Xcode files from the command line isn’t the big deal but the tools like xed can save some time during the development by quickly opening the files in the Xcode without loading the entire workspace. Hope you will also start using xed command in the day to day work for the change or for a fun. Let me know what are your experiences with xed, share in the comment below.