Back to Blog
RNA-SeqAlignment

Install STAR and HISAT2 RNA-seq Aligners (macOS, Apple Silicon, conda)

Install STAR and HISAT2, the two dominant splice-aware RNA-seq aligners, via conda on Apple Silicon, with genome indexing and RAM limits.

SSSudipta SardarJuly 20, 20269 min read
Install STAR and HISAT2 RNA-seq Aligners (macOS, Apple Silicon, conda)

STAR and HISAT2 are the two aligners nearly every RNA-seq pipeline reaches for. Unlike genomic aligners such as BWA or Bowtie2, both are splice-aware: they know a read can legitimately jump across an intron and still map cleanly to two separate exons. In this guide we install both into one conda environment on an Apple Silicon Mac, build a small test index, and talk through the one gotcha that catches almost everyone the first time: STAR's genome index wants a lot of RAM.

Why splice-aware alignment matters

A read from mature mRNA can span an exon-exon junction that does not exist as contiguous sequence in the genome. A standard DNA aligner sees that read as full of mismatches or simply fails to place it. STAR and HISAT2 solve this by allowing gapped alignments across known or discovered splice junctions, using either a suffix-array search (STAR) or a graph-based FM-index (HISAT2). This is also why RNA-seq alignment needs its own tools rather than reusing bwa mem or bowtie2 directly.

STAR vs HISAT2 at a glance

STARHISAT2
Core algorithmUncompressed suffix array + maximal mappable prefix searchHierarchical graph FM-index (HGFM), successor to Bowtie2/TopHat2
Human genome index build RAMRoughly 30 GB with default settingsA few GB — dramatically lighter
Splice junction handlingDetects junctions de novo and from a GTF; very high sensitivityDetects junctions de novo and from a GTF; slightly leaner junction model
Typical roleReference aligner for GATK/known-junction pipelines, gold-standard accuracy comparisonsDefault choice on memory-constrained machines and laptops
Packagestar on biocondahisat2 on bioconda

Both are actively maintained, both ship native Apple Silicon builds, and in practice many labs keep both installed and pick per-project depending on available RAM.

Prerequisites

You need a working conda on your Mac. If you don't have one yet, start with our Miniconda on Apple Silicon guide and come back here. This guide assumes an Apple Silicon Mac (arm64) with a recent conda release using the fast libmamba solver.

We install only from conda-forge and bioconda, passing --override-channels so conda never touches the Anaconda defaults channel. On recent conda versions defaults sits behind a Terms-of-Service prompt, and skipping it entirely avoids that error altogether.

TL;DR: copy-paste install

bash
conda create -n bu-rnaseq-align --override-channels -c conda-forge -c bioconda star hisat2
conda activate bu-rnaseq-align

That's the whole install. The rest of this guide walks through it step by step and covers the RAM planning you actually need before you point either tool at a full human genome.

Step by step

1. Create the environment with both aligners

We put STAR and HISAT2 in one environment, bu-rnaseq-align, since they solve the same problem and are commonly compared or swapped on the same project.

bash
conda create -n bu-rnaseq-align --override-channels -c conda-forge -c bioconda star hisat2

Conda solves the environment and reports the plan. You should see something like this:

Channels:
 - conda-forge
 - bioconda
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  added / updated specs:
    - hisat2
    - star

The following NEW packages will be INSTALLED:

  hisat2             bioconda/osx-arm64::hisat2-...
  star                bioconda/osx-arm64::star-...
  ... (htslib, python, perl, and other shared dependencies)

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

The osx-arm64 tag on every line is the important part: both star and hisat2 publish native Apple Silicon builds on bioconda, so nothing here runs under Rosetta 2.

2. Activate the environment

bash
conda activate bu-rnaseq-align

Both aligners now exist only while this environment is active — deactivate it and they disappear from your PATH, with nothing touched globally.

Apple Silicon note

Because both recipes ship osx-arm64 builds, there is no emulation involved and no special flags needed. You only need the Rosetta fallback (CONDA_SUBDIR=osx-64 conda create ... --override-channels -c conda-forge -c bioconda toolname) if you later add some niche bioconda package to the same pipeline that has no arm64 build yet. Neither STAR nor HISAT2 needs that workaround.

Verify the install

bash
STAR --version
hisat2 --version

You should see something like a plain version string for STAR (e.g. 2.7.11b) and a longer banner for HISAT2 that includes the build compiler and index type, e.g. hisat2-align-s version 2.2.1. Also confirm both binaries resolve inside the environment rather than some stray system copy:

bash
which STAR
which hisat2

Both should point inside .../envs/bu-rnaseq-align/bin/. If you instead get command not found, activate the environment first.

Building a genome index — and why STAR needs so much RAM

This is the step that surprises people. STAR builds an uncompressed suffix array over the entire genome sequence at index time, which is fast to search later but expensive to build: for the full human genome (roughly 3.1 billion bases) with default settings, expect the genomeGenerate step to need roughly 30 GB of RAM. A MacBook Air or base MacBook Pro with 8 or 16 GB of unified memory will not get through a full human genome index — the process will either swap heavily or be killed by the OS.

A typical STAR index build looks like this:

bash
STAR --runMode genomeGenerate \
  --genomeDir star_index \
  --genomeFastaFiles genome.fa \
  --sjdbGTFfile annotation.gtf \
  --sjdbOverhang 100 \
  --runThreadN 4

--sjdbOverhang should be set to your read length minus 1 (100 is the common default for 100 bp reads); it tells STAR how much sequence around each annotated splice junction to index.

If you are on a laptop, you have a few real options:

  • Test with a small genome first. Index a single chromosome, a bacterial genome, or a toy reference while developing your pipeline, and save the full human genome index build for a server or cloud instance with 32 GB or more of RAM.
  • Reduce STAR's memory footprint. Increase --genomeSAsparseD (e.g. to 2) to build a sparser suffix array — the index is smaller and uses less RAM, at some cost to alignment speed. You can also cap the ceiling explicitly with --limitGenomeGenerateRAM, though setting it too low simply makes the build fail rather than succeed slowly.
  • Use HISAT2 instead. Its hierarchical graph FM-index needs only a few gigabytes to build and align against the human genome, a fraction of STAR's requirement, which is exactly why it is the more laptop-friendly default.

For small or synthetic reference genomes (well under a few megabases), STAR's default --genomeSAindexNbases 14 is too large and STAR will warn or fail. The manual's recommended formula is min(14, log2(GenomeLength)/2 - 1) — for a 20,000 bp toy genome that works out to roughly 7.

HISAT2's index build is comparatively gentle:

bash
hisat2-build genome.fa hisat2_index/genome

No RAM flags to worry about for a typical single-genome index — this is one of the reasons HISAT2 (and its predecessor TopHat2) became the default teaching aligner for RNA-seq courses run on ordinary laptops.

Smoke test with a tiny reference

The commands below are correct to run yourself, but were not executed on a real machine for this guide — treat the exact output as illustrative rather than a captured transcript.

bash
cd $(mktemp -d)
printf '>chr1\nACGTACGTACGTAGCTAGCTAGCTAGGCTAGCTAGCATCGATCGATCGTACGATCGATCGA\n' > genome.fa
printf '@r1\nAGCTAGCTAGCATCGATCG\n+\nIIIIIIIIIIIIIIIIIII\n' > reads.fq

# STAR (tiny genome needs a reduced --genomeSAindexNbases)
STAR --runMode genomeGenerate --genomeDir star_idx \
  --genomeFastaFiles genome.fa --genomeSAindexNbases 4
STAR --genomeDir star_idx --readFilesIn reads.fq --outSAMtype SAM

# HISAT2
hisat2-build genome.fa hisat2_idx
hisat2 -x hisat2_idx -U reads.fq -S hisat2.sam

A successful run produces a SAM record for r1 on chr1 from each aligner, with the FLAG field showing it as mapped (not 4, which means unmapped).

Common errors and fixes

ErrorFix
PackagesNotFoundError / Terms-of-Service prompt for the defaults channelNever use defaults for bioconda tools. Install with --override-channels -c conda-forge -c bioconda exactly as shown.
STAR's genomeGenerate is killed with no clear error (Killed: 9)Out-of-memory kill from the OS. Use a smaller reference for local testing, raise --genomeSAsparseD, or move the full human genome index build to a machine with 32 GB or more RAM.
EXITING: FATAL INPUT ERROR: ... --genomeSAindexNbases warning on a small genomeLower --genomeSAindexNbases using min(14, log2(GenomeLength)/2 - 1) as shown above.
STAR: command not found / hisat2: command not foundThe environment isn't active. Run conda activate bu-rnaseq-align, then which STAR / which hisat2.
HISAT2 complains about mismatched paired files (-1/-2)The two FASTQ files have a different number of reads or are out of sync. Re-pair them (e.g. with seqkit pair) before aligning.
Very slow or hanging Solving environmentUse the fast libmamba solver (default since conda 23.10) or install Miniforge/mamba and run mamba create ... instead.

Managing the environment

Update both aligners in place:

bash
conda update -n bu-rnaseq-align --override-channels -c conda-forge -c bioconda star hisat2

Snapshot the exact environment so a collaborator or a cluster job can reproduce it:

bash
conda env export -n bu-rnaseq-align > bu-rnaseq-align.yaml

And remove it cleanly when you're done — nothing outside the environment was ever touched:

bash
conda remove -n bu-rnaseq-align --all

Next steps

With reads aligned, the natural next stop is sorting and indexing the resulting BAM with Install SAMtools and BCFtools, then moving on to counting and differential expression as covered in RNA-Seq Analysis: From Raw Reads to Differential Expression. If you're still deciding between full alignment and lighter-weight pseudo-alignment for your project, Install Salmon covers the transcript-quantification alternative to a full genome index.