FedoraRHEL Based

How To Install Emacs on Fedora 40

Install Emacs on Fedora 40

In this tutorial, we will show you how to install Emacs on Fedora 40. Emacs is more than just a text editor; it’s a customizable, self-documenting, real-time display editor. Its key features include syntax highlighting, version control integration, and a powerful extension ecosystem. Unlike other editors, Emacs allows users to write their own extensions in Emacs Lisp, making it highly adaptable to individual workflows. Whether you’re a software developer, a writer, or a data analyst, Emacs can be tailored to meet your specific requirements.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Emacs on Fedora 40.

Prerequisites

Before we dive into the installation process, ensure that you have the following prerequisites in place:

  • A server running one of the following operating systems: Fedora 40.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora provides the Terminal application for this purpose. It can be found in your Applications menu.
  • A stable internet connection to download the necessary packages.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Emacs on Fedora 40

Step 1. Update System Packages

Before installing Emacs, it is essential to ensure that your Fedora 40 system is up to date. Open the terminal and run the following command to update your system:

sudo dnf clean all
sudo dnf update

This command will fetch the latest package information and upgrade any outdated packages to their latest versions. Keeping your system updated ensures that you have access to the latest bug fixes, security patches, and compatibility improvements.

Step 2. Installing Emacs.

  • Method 1: Installing Emacs Using DNF Package Manager

The simplest and most common method to install Emacs on Fedora 40 is using the DNF package manager. Follow these steps to install Emacs using DNF:

sudo dnf install emacs

Once the installation is complete, you can verify that Emacs is installed correctly by running:

emacs --version
  • Method 2: Installing Emacs from Source

For users who require the latest features or want more control over the installation process, installing Emacs from source is a viable option. Follow these steps to compile and install Emacs from source on Fedora 40:

Before compiling Emacs, you need to install the required build dependencies. Run the following command:

sudo dnf install gcc make autoconf automake texinfo gtk3-devel webkit2gtk3-devel libXpm-devel libtiff-devel libpng-devel libjpeg-turbo-devel giflib-devel ncurses-devel gnutls-devel

Visit the official GNU Emacs website and download the latest stable release of the Emacs source code. At the time of writing, the latest version is 28.2. You can download the source code using the following command:

wget https://ftp.gnu.org/gnu/emacs/emacs-28.2.tar.gz

Extract the downloaded source code archive:

tar xvf emacs-28.2.tar.gz

Change to the extracted directory:

cd emacs-28.2

Configure the build with the desired options:

./configure --with-x-toolkit=gtk3 --with-xwidgets

Compile the source code:

make

Install Emacs system-wide:

sudo make install

After the installation is complete, verify that Emacs is installed correctly by running:

emacs --version
  • Method 3: Installing Emacs via Flatpak

Flatpak is a popular package management system that allows you to install applications in a sandboxed environment, ensuring better security and compatibility. Follow these steps to install Emacs using Flatpak on Fedora 40:

If you don’t have Flatpak installed on your system, you can install it using the following command:

sudo dnf install flatpak

Flathub is a central repository for Flatpak applications. Add the Flathub repository to your system by running:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

To install Emacs using Flatpak, run the following command:

flatpak install flathub org.gnu.emacs

To launch Emacs installed via Flatpak, use the following command:

flatpak run org.gnu.emacs

Install Emacs on Fedora 40

Step 3. Troubleshooting Common Issues

If you encounter any issues while installing or using Emacs on Fedora 40, here are some common problems and their solutions:

    • If you see an error message about missing dependencies during installation, ensure that you have enabled the necessary repositories and run sudo dnf update before retrying the installation.
    • If Emacs fails to start or crashes unexpectedly, try starting it from the terminal using the command emacs -Q. This starts Emacs without loading any custom configurations, helping you identify if the issue is related to your init.el file.
    • If you experience performance issues or slow startup times, consider disabling unused packages or optimizing your init.el file. You can also try starting Emacs with the --no-init-file option to bypass the initialization file entirely.

Congratulations! You have successfully installed Emacs. Thanks for using this tutorial for installing the Emacs on Fedora 40 system. For additional help or useful information, we recommend you check the official Emacs website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button