Installing GUI Emacs on Ubuntu with the fewest dependencies, particularly without an MTA (Mail Transfer Agent) and mail utilities, can be achieved by compiling Emacs from source. This method allows you to control which dependencies are included. Here’s a step-by-step guide to do this:
Step 1: Update Your System
First, ensure your system is up to date.
sudo apt update && sudo apt upgrade -y
Step 2: Install Build Essentials and Dependencies
Install the necessary build tools and minimal dependencies for Emacs.
sudo apt install -y build-essential libncurses5-dev libx11-dev libxpm-dev libgif-dev libjpeg-dev libpng-dev libgtk-3-dev
Note: We intentionally do not install any mail-related packages such as mailutils, postfix, or exim4.
Step 3: Download Emacs Source Code
Download the latest stable release of Emacs from the GNU Emacs website or use wget:
wget https://ftp.gnu.org/gnu/emacs/emacs-29.1.tar.gz
tar -xzvf emacs-29.1.tar.gz
cd emacs-29.1
Step 4: Configure the Build
When configuring the build, you can disable features you don't want, including mail-related features. Use the --without-mailutils option to ensure mail utilities are not included.
./configure --prefix=/usr/local/emacs --without-mailutils
Here, --prefix=/usr/local/emacs installs Emacs to /usr/local/emacs. You can change this to any directory you prefer.
Step 5: Compile and Install
Compile and install Emacs.
make
sudo make install
This process may take some time.
Step 6: Create a Desktop Entry (Optional)
To easily launch Emacs from your application menu, you can create a .desktop entry.
Create the file /usr/local/emacs/share/applications/emacs.desktop with the following content:
[Desktop Entry]
Name=Emacs
Comment=The extensible, self-documenting text editor
Exec=/usr/local/emacs/bin/emacs %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Then, update the desktop database:
sudo update-desktop-database /usr/local/emacs/share/applications/
Step 7: Run Emacs
You can now run Emacs from the terminal or your application menu.
/usr/local/emacs/bin/emacs &
Verification
To ensure that no MTA or mail utilities were installed, you can check the installed packages:
dpkg -l | grep -i mail
You should not see any mail-related packages such as mailutils, postfix, or exim4 in the list.
By following these steps you have installed GUI Emacs with the fewest dependencies and without any MTA or mail utilities.