<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2024-06-17</periodOfReport>

    <issuer>
        <issuerCik>0001177648</issuerCik>
        <issuerName>ENANTA PHARMACEUTICALS INC</issuerName>
        <issuerTradingSymbol>ENTA</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001834835</rptOwnerCik>
            <rptOwnerName>Kieffer Tara Lynn</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O ENANTA PHARMACEUTICALS, INC.</rptOwnerStreet1>
            <rptOwnerStreet2>500 ARSENAL STREET</rptOwnerStreet2>
            <rptOwnerCity>WATERTOWN</rptOwnerCity>
            <rptOwnerState>MA</rptOwnerState>
            <rptOwnerZipCode>02472</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>0</isDirector>
            <isOfficer>1</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle>Chief Product Strategy Officer</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>1</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2024-06-17</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
                <footnoteId id="F1"/>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>7266</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>12.33</value>
                    <footnoteId id="F2"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>32341</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">The sales reported in this Form 4 were effected pursuant to a Rule 10b5-1 trading plan adopted by the reporting person in March 2024.</footnote>
        <footnote id="F2">The price reported in Column 4 is a weighted-average price. These shares were sold in multiple transactions at prices ranging from $12.20 to $12.54, inclusive.</footnote>
    </footnotes>

    <remarks>The reporting person undertakes to provide to Enanta Pharmaceuticals, Inc., any security holder of Enanta Pharmaceuticals, Inc., or the staff of the Securities and Exchange Commission, upon request, full information regarding the number of shares sold at each separate price within the range set forth in footnote 2 above.</remarks>

    <ownerSignature>
        <signatureName>/s/ Paul J. Mellett as attorney-in-fact</signatureName>
        <signatureDate>2024-06-17</signatureDate>
    </ownerSignature>
</ownershipDocument>
