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

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2023-12-05</periodOfReport>

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

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001607643</rptOwnerCik>
            <rptOwnerName>Gardiner Nathaniel S.</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>Sr. VP &amp; General Counsel</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2023-12-05</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>2412</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>9.63</value>
                    <footnoteId id="F2"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>68154</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>35926</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>By grantor retained annuity trust</value>
                    <footnoteId id="F3"/>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">Represents shares sold by the reporting person to cover withholding taxes due as a result of settlement of a portion of the restricted stock unit award granted on November 23, 2022, as required pursuant to the terms of the award. The sale was to satisfy tax withholding obligations to be funded by a &quot;sell to cover&quot; transaction and does not represent a discretionary transaction by the reporting person.</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 $9.47 to $9.63, inclusive. 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 ranges set forth set forth in this footnote of this Form 4.</footnote>
        <footnote id="F3">These shares are held by grantor retained annuity trusts created by the reporting person for the benefit of himself and his two adult children.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Nathaniel S. Gardiner</signatureName>
        <signatureDate>2023-12-06</signatureDate>
    </ownerSignature>
</ownershipDocument>
